UnitTestEx provides .NET testing extensions to the most popular testing frameworks (MSTest, NUnit and Xunit) specifically to improve the testing experience with ASP.NET controller, and Azure Function, execution including underlying HttpClientFactory mocking.
I have a following tests that passes with "UnitTestEx.Xunit" Version="2.1.1"
// Arrange
using var test = CreateApiTester<Startup>();
// Act
var result = test
.Controller<SampleController>()
.Run(c => c.Get("thisIsATest"))
.AssertOK()
.AssertJson("{\"data\": \"this_is_a_test\"}");
but this also passes and shouldn't
// Act
var result = test
.Controller<SampleController>()
.Run(c => c.Get("thisIsATest"))
.AssertOK()
.Assert(new { foo="bar"});
I have a following tests that passes with
"UnitTestEx.Xunit" Version="2.1.1"
but this also passes and shouldn't