DotNetToolbox.FluentAssertions 8.0.4

dotnet add package DotNetToolbox.FluentAssertions --version 8.0.4
NuGet\Install-Package DotNetToolbox.FluentAssertions -Version 8.0.4
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DotNetToolbox.FluentAssertions" Version="8.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DotNetToolbox.FluentAssertions --version 8.0.4
#r "nuget: DotNetToolbox.FluentAssertions, 8.0.4"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DotNetToolbox.FluentAssertions as a Cake Addin
#addin nuget:?package=DotNetToolbox.FluentAssertions&version=8.0.4

// Install DotNetToolbox.FluentAssertions as a Cake Tool
#tool nuget:?package=DotNetToolbox.FluentAssertions&version=8.0.4

TestUtilities (DotNetToolbox.TestUtilities)

Introduction

DotNetToolbox.FluentAssertions is an extension of FluentAssertions, tailored for .NET 8, aimed at providing specialized assertion capabilities for logging components in .NET applications. It enhances test readability and maintainability by offering clear and concise assertion methods.

Table of Contents

  1. Installation
  2. Dependencies
  3. Features
  4. Usage
  5. Configuration
  6. Contributors
  7. License

Installation

PM> Install-Package DotNetToolbox.FluentAssertions

Dependencies

  • DotNetToolbox.TestUtilities >= 8.0.4-rc1
  • FluentAssertions >= 6.12.0

Features

  • Logger Assertions: Custom assertions for testing logging behavior.
  • Logger Extensions: Extension methods for FluentAssertions to work seamlessly with ILogger instances.

Usage

The library can be used in unit tests to assert various states and behaviors of loggers in .NET applications. Here are some examples:

    logger.Should().BeEmpty();
    logger.Should().HaveExactly(2);
    logger.Contain(LogLevel.Information);
    logger.Contain("Test 1.");
    logger.ContainExactly(2, LogLevel.Error, "Error message.");

Configuration

No additional configuration is required beyond the standard setup for FluentAssertions.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
8.0.4 142 2/5/2024
8.0.3 120 1/11/2024

v8.0.4:

     Stable release of the DotNetToolbox.FluentAssertions library, an extension of FluentAssertions, tailored for .NET 8, aimed at providing specialized assertion capabilities for logging components in .NET applications. It enhances test readability and maintainability by offering clear and concise assertion methods.

     Key Features:
     - LoggerAssertions: Custom assertions for testing logging behavior.
     - LoggerExtensions: Extension methods for FluentAssertions to work seamlessly with 'ILogger' instances.