Looking for a basic assert in xUnit. This is simple in MSTest and NUnit.
Assert.Fail("some message"); // MSTest - works
Assert.Fail("some message"); // NUnit - works (same syntax)
Assert.Fail("some message"); // xUnit - does not compile
The project is a C# xUnit Test Project (.NET Core)
in Visual Studio 2019.
UPDATE
Responding to comments about what version of xUnit is installed. The NuGet package was installed automatically by Visual Studio when the project was created. The .csproj
file reveals that Visual Studio installed version "2.4.0".
CodePudding user response:
In XUnit assert message is a parameter. It is part of all Assert Extension Methods.
For example :
Assert.False(true, "true will never be false")
CodePudding user response:
xunit 2.4.2-pre.12 contains the Assert.Fail(string)
method.
However, as was pointed out in the comments, this was recently added so prior versions do not contain the Assert.Fail()
method.