-
Book Overview & Buying
-
Table Of Contents
Apps and Services with .NET 8 - Second Edition
By :
FluentAssertions are a set of extension methods that make writing and reading the code in unit tests and the error messages of failing tests more similar to a natural human language like English.
It works with most unit testing frameworks, including xUnit. When you add a package reference for a test framework, FluentAssertions will automatically find the package and use it for throwing exceptions.
After importing the FluentAssertions namespace, call the Should() extension method on a variable and then one of the hundreds of other extension methods to make assertions in a human-readable way. You can chain multiple assertions using the And() extension method or have separate statements, each calling Should().
Let’s start by making assertions about a single string value:
xunit named FluentTests to a Chapter06 solution...