FluentAssertions
provides extension methods for your asserts
Basic Assertions
1 | object theObject = null; |
Equivalent To
Should().BeEquivalentTo(...)
asserts that an object is equivalent to another object.
1 | // v5.9.0 |
Awaiting Exceptions
“Invokes the specified action on a subject so that you can chain it with any of the assertions from FluentAssertions.Specialized.GenericAsyncFunctionAssertions`”
// Act
// Assert
classUnderTest
.Awaiting(x => x.SomeMethod(someParameter))
.Should().Throw<FooCustomExceptionException>()
.And.StatusCode.Should().Be(StatusCodes.Status503ServiceUnavailable); // Microsoft.AspNetCore.Http