VOOZH about

URL: https://www.nuget.org/packages/Rystem.Test.XUnit/9.0.27

⇱ NuGet Gallery | Rystem.Test.XUnit 9.0.27




👁 Image
Rystem.Test.XUnit 9.0.27

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

What is Rystem?

Get Started with Rystem XUnitTest helpers

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;
 }
}

TypeToChooseTheRightAssemblyToRetrieveSecretsForConfiguration

This property is the Type to discover the right assembly to retrieve secrets.\

TypeToChooseTheRightAssemblyWithControllersToMap

This property is the Type to discover the right assembly to map controllers automatically.\

AppSettingsFileName

This property is the name of the appsettings file to load the configuration.

HasTestHost

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;
}

ConfigureCientServices

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. 
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.

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
Loading failed