![]() |
VOOZH | about |
dotnet add package Rystem.Test.XUnit --version 9.1.1
NuGet\Install-Package Rystem.Test.XUnit -Version 9.1.1
<PackageReference Include="Rystem.Test.XUnit" Version="9.1.1" />
<PackageVersion Include="Rystem.Test.XUnit" Version="9.1.1" />Directory.Packages.props
<PackageReference Include="Rystem.Test.XUnit" />Project file
paket add Rystem.Test.XUnit --version 9.1.1
#r "nuget: Rystem.Test.XUnit, 9.1.1"
#:package Rystem.Test.XUnit@9.1.1
#addin nuget:?package=Rystem.Test.XUnit&version=9.1.1Install as a Cake Addin
#tool nuget:?package=Rystem.Test.XUnit&version=9.1.1Install as a Cake Tool
You have to add a startup class in your test project to initialize the Rystem XUnit helpers.
public class Startup : StartupHelper
{
protected override string? AppSettingsFileName => "appsettings.test.json";
protected override bool HasTestHost => true;
protected override Type? TypeToChooseTheRightAssemblyToRetrieveSecretsForConfiguration => typeof(Startup);
protected override Type? TypeToChooseTheRightAssemblyWithControllersToMap => typeof(ServiceController);
protected override IServiceCollection ConfigureCientServices(IServiceCollection services)
{
services.AddHttpClient("client", x =>
{
x.BaseAddress = new Uri("http://localhost");
});
return services;
}
protected override ValueTask ConfigureServerMiddlewaresAsync(IApplicationBuilder applicationBuilder, IServiceProvider serviceProvider)
{
applicationBuilder.UseTestApplication();
return ValueTask.CompletedTask;
}
protected override ValueTask ConfigureServerServicesAsync(IServiceCollection services, IConfiguration configuration)
{
services.AddTestServices();
return ValueTask.CompletedTask;
}
}
This property is the Type to discover the right assembly to retrieve secrets.\
This property is the Type to discover the right assembly to map controllers automatically.\
This property is the name of the appsettings file to load the configuration.
This property allows the Test server to start. You have to override ConfigureServerMiddlewaresAsync and ConfigureServerServicesAsync.
applicationBuilder.UseTestApplication() is an example of your middlewares from your api project.
public static IApplicationBuilder UseTestApplication(this IApplicationBuilder app)
{
app.UseRuntimeServiceProvider();
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(x =>
{
x.MapControllers();
});
return app;
}
and with the same behavior services.AddTestServices(); adds the services from your api project.
public static IServiceCollection AddTestServices(this IServiceCollection services)
{
services.AddRuntimeServiceProvider();
services.AddControllers();
services.AddEndpointsApiExplorer();
services.AddSingleton<SingletonService>();
services.AddSingleton<Singleton2Service>();
services.AddScoped<ScopedService>();
services.AddScoped<Scoped2Service>();
services.AddTransient<TransientService>();
services.AddTransient<Transient2Service>();
return services;
}
This method configure the DI in your XUnit test project. Usually you need to inject the http client to test your api if you need the test server.
services.AddHttpClient("client", x =>
{
x.BaseAddress = new Uri("http://localhost");
});
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 10.0.8 | 5,919 | 5/13/2026 |
| 10.0.7 | 198 | 3/26/2026 |
| 10.0.6 | 433,592 | 3/3/2026 |
| 10.0.5 | 157 | 2/22/2026 |
| 10.0.4 | 165 | 2/9/2026 |
| 10.0.3 | 147,972 | 1/28/2026 |
| 10.0.1 | 209,125 | 11/12/2025 |
| 9.1.3 | 296 | 9/2/2025 |
| 9.1.2 | 764,560 | 5/29/2025 |
| 9.1.1 | 97,842 | 5/2/2025 |
| 9.0.32 | 186,804 | 4/15/2025 |
| 9.0.31 | 5,853 | 4/2/2025 |
| 9.0.30 | 88,876 | 3/26/2025 |
| 9.0.29 | 9,011 | 3/18/2025 |
| 9.0.28 | 245 | 3/17/2025 |
| 9.0.27 | 241 | 3/16/2025 |
| 9.0.26 | 258 | 3/13/2025 |
| 9.0.25 | 52,143 | 3/9/2025 |
| 9.0.21 | 360 | 3/6/2025 |
| 9.0.20 | 19,583 | 3/6/2025 |