Fluent Assertions Documentation
In This Topic
    Available Assertions
    In This Topic

    A large number of assertions are available. A flat list of assertions would be difficult to navigate.

    Instead, start with the type that contains the value that needs to be asserted, it will most likely be found in the general groups of this page (primitives, numeric, collections, etc). The convention is that assertions for a specified type are located in a class with the name <type name>Assertions. For example, DateTimeAssertions for the DateTime type.

    Then, click on the relevant assertions class. This links to the class reference documentation. Look at the Public Methods section. Each method in the list is an assertion available for calling when a class instance is obtained from a Should() extension method.

     Primitives

    Assertion classes for many of the primitive data types in the .NET framework like String, Boolean, DateTime, reference types (meaning all classes that derive from System.Object) are grouped in the FluentAssertions.Primitives Namespace.

    Click Overview for a class list with a brief description of each class. Or click on a specific class from the list below to see the assertions it offers in the Public Methods section.

     Numeric

    Assertions classes for numeric data types of the .NET framework are grouped in the FluentAssertions.Numeric Namespace.

    Click Overview for a class list with a brief description of each class. Or click on a specific class from the list below to see the assertions it offers in the Public Methods section.

     Collections
     Events

    Assertions classes for various .NET framework collection classes are grouped in the FluentAssertions.Events Namespace.

    Click Overview for a class list with a brief description of each class. Or click on a specific class from the list below to see the assertions it offers in the Public Methods section.

     Specialized

    Assertions classes for various specialized concepts like asserting on executation time, exceptions, asynchronous methods, delegates and other anonymous methods are grouped in the FluentAssertions.Specialized Namespace.

    Click Overview for a class list with a brief description of each class. Or click on a specific class from the list below to see the assertions it offers in the Public Methods section.

     Streams

    Assertions classes for some .NET framework System.IO.Stream classes are grouped in the FluentAssertions.Streams Namespace.

    Click Overview for a class list with a brief description of each class. Or click on a specific class from the list below to see the assertions it offers in the Public Methods section.

     Types

    Assertions classes for the System.Type class and its related data structures like MethodInfo, PropertyInfo, etc, are grouped in the FluentAssertions.Types Namespace.

    Click Overview for a class list with a brief description of each class. Or click on a specific class from the list below to see the assertions it offers in the Public Methods section.

     Xml

    Assertions classes for some System.Xml classes like XmlDocument, and its related data structures line XmlNode and XmlAttribute are grouped in the FluentAssertions.Xml Namespace.

    Click Overview for a class list with a brief description of each class. Or click on a specific class from the list below to see the assertions it offers in the Public Methods section.