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
<PackageReference Include="Soenneker.Tests.Unit" Version="11.0.1436" />
<PackageVersion Include="Soenneker.Tests.Unit" Version="11.0.1436" />
<PackageReference Include="Soenneker.Tests.Unit" />
paket add Soenneker.Tests.Unit --version 11.0.1436
#r "nuget: Soenneker.Tests.Unit, 11.0.1436"
#:package Soenneker.Tests.Unit@11.0.1436
#addin nuget:?package=Soenneker.Tests.Unit&version=11.0.1436
#tool nuget:?package=Soenneker.Tests.Unit&version=11.0.1436
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 | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- Soenneker.Serilog.Sinks.TUnit (>= 11.0.172)
- Soenneker.Tests.Logging (>= 11.0.173)
- Soenneker.Utils.AutoBogus (>= 11.0.1011)
- Soenneker.Utils.Logger (>= 11.0.596)
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 |
Update dependency Soenneker.Serilog.Sinks.TUnit to 11.0.172 (#1512)