Sylin.Koan.Testing.Hosting 0.20.4

dotnet add package Sylin.Koan.Testing.Hosting --version 0.20.4
                    
NuGet\Install-Package Sylin.Koan.Testing.Hosting -Version 0.20.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="Sylin.Koan.Testing.Hosting" Version="0.20.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Sylin.Koan.Testing.Hosting" Version="0.20.4" />
                    
Directory.Packages.props
<PackageReference Include="Sylin.Koan.Testing.Hosting" />
                    
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 Sylin.Koan.Testing.Hosting --version 0.20.4
                    
#r "nuget: Sylin.Koan.Testing.Hosting, 0.20.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.
#:package Sylin.Koan.Testing.Hosting@0.20.4
                    
#: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=Sylin.Koan.Testing.Hosting&version=0.20.4
                    
Install as a Cake Addin
#tool nuget:?package=Sylin.Koan.Testing.Hosting&version=0.20.4
                    
Install as a Cake Tool

Sylin.Koan.Testing.Hosting

Boot the application composition you actually want to test. KoanIntegrationHost wraps a real .NET generic host without taking a dependency on xUnit or choosing which Koan modules to activate. Use it when a test needs DI, hosted-service lifecycle, and Koan's normal compiled composition path.

Install

dotnet add package Sylin.Koan.Testing.Hosting

Start a host

using Koan.Core;
using Koan.Testing.Integration;
using Microsoft.Extensions.DependencyInjection;

await using var host = await KoanIntegrationHost.Configure()
    .WithSetting("Koan:Data:Sources:Default:Adapter", "inmemory")
    .ConfigureServices(services => services.AddKoan())
    .StartAsync();

var service = host.Services.GetRequiredService<MyApplicationService>();

The default environment is Test. In-memory settings are applied first; configuration sources added through ConfigureAppConfiguration can override them. ConfigureServices is additive and may be called more than once.

The helper deliberately does not call AddKoan() for you. Tests can choose full discovery, a smaller Core composition, or entirely custom registrations without the hosting package inferring intent from assemblies it does not own.

Meaningful result: one owned host

The returned IntegrationHost exposes the real service provider and hosted-service lifecycle, so composition assertions exercise the same AddKoan() discovery path as the application.

Ownership contract

  • Build() transfers an unstarted host to the caller, who must dispose it.
  • StartAsync() owns the built host until startup succeeds. If startup fails, it disposes the host before rethrowing the original startup exception.
  • A successfully returned host belongs to the caller and should be used with await using.
  • Disposal asks hosted services to stop, always attempts the host's asynchronous disposal path, and fails the test if either phase fails; dual failures are reported together.

Choose it when

  • a focused integration test needs the same generic-host lifecycle as the application;
  • a module or adapter test needs explicit configuration and service overrides;
  • an agent needs a small, inspectable composition seam instead of recreating bootstrap wiring.

Boundaries

Do not use it for pure unit tests or as an application runtime abstraction. Real Koan hosts in the same test process should remain sequential: owner-safe teardown prevents an older host from clearing a newer owner, but simultaneous static Entity operations still share the process-default binding.

See TECHNICAL.md for the lifecycle and failure contract.

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 (2)

Showing the top 2 NuGet packages that depend on Sylin.Koan.Testing.Hosting:

Package Downloads
Sylin.Koan.Testing.Containers

Koan test harness — xUnit v3 Testcontainers fixtures (KoanContainerFixture / KoanDataSpec) for engine-backed integration tests.

Sylin.Koan.Testing

Koan conformance kit — your app inherits a test suite. Subclass EntityConformanceSpecs<T> (one method per entity); trait-gated batteries run round-trip, pushdown-vs-reference-oracle, paging, partition isolation, caching and embedding conformance automatically.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.20.4 117 7/22/2026
0.20.3 160 7/22/2026