Soenneker.Tests.Unit 11.0.1436

Prefix Reserved
dotnet add package Soenneker.Tests.Unit --version 11.0.1436
                    
NuGet\Install-Package Soenneker.Tests.Unit -Version 11.0.1436
                    
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="Soenneker.Tests.Unit" Version="11.0.1436" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Tests.Unit" Version="11.0.1436" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Tests.Unit" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Soenneker.Tests.Unit --version 11.0.1436
                    
#r "nuget: Soenneker.Tests.Unit, 11.0.1436"
                    
#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.
#:package Soenneker.Tests.Unit@11.0.1436
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Soenneker.Tests.Unit&version=11.0.1436
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Tests.Unit&version=11.0.1436
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

Soenneker.Tests.Unit

A TUnit base class with Bogus, AutoFaker, and per-test Serilog output, without a dependency-injection container.

Installation

dotnet add package Soenneker.Tests.Unit

Usage

using Soenneker.Tests.Unit;

public sealed class OrderNumberTests : UnitTest
{
    [Test]
    public async Task Formats_customer_and_sequence()
    {
        string customer = Faker.Random.AlphaNumeric(8);
        var request = AutoFaker.Generate<CreateOrderRequest>();

        Logger.LogInformation("Checking order number for {Customer}", customer);

        string result = OrderNumber.Create(customer, request.Sequence);

        await Assert.That(result).StartsWith(customer);
    }
}

Faker and AutoFaker are created lazily for each test-class instance. The Bogus Faker exposed by the base is the one owned by that AutoFaker, so both follow the same generator configuration.

Logger writes through a private Serilog pipeline to the active TUnit test context. TUnit calls the base class's asynchronous lifecycle methods and the pipeline is released during test teardown.

Choosing the right base

UnitTest intentionally has no IServiceProvider and cannot resolve application services. Use Soenneker.Tests.HostedUnit with Soenneker.TestHosts.Unit when the subject needs dependency injection or scoped services.

Derived infrastructure can pass an existing AutoFaker to the protected constructor. It can also set enableLogging: false when logging is supplied by a host, but must then configure LazyLogger before using Logger or a logged Delay.

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Soenneker.Tests.Unit:

Package Downloads
Soenneker.Tests.FixturedUnit

A fundamental xUnit test that stores UnitFixture and provides synthetic inversion of control

Soenneker.Tests.HostedUnit

A fundamental test that stores the TestHost and provides synthetic inversion of control

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
11.0.1436 0 11/15/2026
11.0.1435 2,876 11/13/2026
11.0.1434 3,703 11/11/2026
11.0.1433 220 11/11/2026
11.0.1432 1,059 11/11/2026
11.0.1431 1,120 11/11/2026
11.0.1430 1,166 11/11/2026
11.0.1429 202 11/11/2026
11.0.1428 2,071 11/11/2026
11.0.1427 158 11/11/2026
11.0.1426 776 11/11/2026
11.0.1425 13,120 11/10/2026
11.0.1424 9,229 11/7/2026
11.0.1423 3,137 11/6/2026
11.0.1422 8,133 11/4/2026
11.0.1421 1,611 11/3/2026
11.0.1420 4,476 11/3/2026
11.0.1419 3,456 11/3/2026
11.0.1418 1,534 11/3/2026
11.0.1417 269 11/3/2026
Loading failed

Update dependency Soenneker.Serilog.Sinks.TUnit to 11.0.172 (#1512)