NOF.Test 10.5.0

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package NOF.Test --version 10.5.0
                    
NuGet\Install-Package NOF.Test -Version 10.5.0
                    
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="NOF.Test" Version="10.5.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NOF.Test" Version="10.5.0" />
                    
Directory.Packages.props
<PackageReference Include="NOF.Test" />
                    
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 NOF.Test --version 10.5.0
                    
#r "nuget: NOF.Test, 10.5.0"
                    
#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 NOF.Test@10.5.0
                    
#: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=NOF.Test&version=10.5.0
                    
Install as a Cake Addin
#tool nuget:?package=NOF.Test&version=10.5.0
                    
Install as a Cake Tool

NOF.Test

Testing support package for applications built with the NOF Framework.

Overview

NOF.Test is designed for application developers using NOF.

It helps you write:

  • Unit tests for application services and handlers with a lightweight NOF-aware host
  • Integration tests that exercise DI wiring, invocation context, command sender and notification publisher flows
  • Scenario tests that need tenant, user, and tracing context without booting a full web server

What It Provides

NOFTestAppBuilder

Creates a lightweight host builder for tests while still going through the NOF registration pipeline.

var builder = NOFTestAppBuilder.Create();
await using var host = await builder.BuildTestHostAsync();

NOFTestHost

Wraps the built IHost and provides convenient helpers for application tests:

  • CreateScope()
  • GetRequiredService<T>()
  • SendAsync<TCommand>(TCommand)
  • PublishAsync<TNotification>(TNotification)

NOFTestScope

Represents a scoped test execution context. It makes it easy to configure execution context before invoking application logic:

  • SetTenant(...)
  • SetTracing(...)
  • SetUser(...)
  • SetAnonymousUser()

When a test scope is created, NOF also activates scoped daemon services so ambient conveniences such as Mapper, IdGenerator, and EventPublisher behave the same way they do in normal NOF execution scopes.

using var scope = host.CreateScope();

scope.SetTenant("tenant-a")
    .SetUser("user-1", "Alice", ["orders.read"]);

await scope.SendAsync(new RebuildProjectionCommand("orders"));
await scope.PublishAsync(new OrderSyncedNotification(orderId));

Installation

dotnet add package NOF.Test

License

Apache-2.0

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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.