![]() |
VOOZH | about |
dotnet add package Archetypical.Software.Vega.Api.IntegrationTests.Framework --version 2.7.1
NuGet\Install-Package Archetypical.Software.Vega.Api.IntegrationTests.Framework -Version 2.7.1
<PackageReference Include="Archetypical.Software.Vega.Api.IntegrationTests.Framework" Version="2.7.1" />
<PackageVersion Include="Archetypical.Software.Vega.Api.IntegrationTests.Framework" Version="2.7.1" />Directory.Packages.props
<PackageReference Include="Archetypical.Software.Vega.Api.IntegrationTests.Framework" />Project file
paket add Archetypical.Software.Vega.Api.IntegrationTests.Framework --version 2.7.1
#r "nuget: Archetypical.Software.Vega.Api.IntegrationTests.Framework, 2.7.1"
#:package Archetypical.Software.Vega.Api.IntegrationTests.Framework@2.7.1
#addin nuget:?package=Archetypical.Software.Vega.Api.IntegrationTests.Framework&version=2.7.1Install as a Cake Addin
#tool nuget:?package=Archetypical.Software.Vega.Api.IntegrationTests.Framework&version=2.7.1Install as a Cake Tool
Reusable integration-testing primitives for applications built on Archetypical.Software.Vega.Api.Abstractions.
This package provides:
Microsoft.AspNetCore.TestHost.Testcontainers) for common providers.Reference the package from your test project:
<ItemGroup>
<PackageReference Include="Archetypical.Software.Vega.Api.IntegrationTests.Framework" Version="<version>" />
</ItemGroup>
The host starts a VegaApiApplication in-memory (TestServer) and returns:
WebApplication AppHttpClient Clientusing Archetypical.Software.Vega.Api.IntegrationTests.Framework.Hosting;
var (app, client) = await VegaTestHost.StartAsync(
new Dictionary<string, string?>
{
["VEGA:DBCONTEXT:PROVIDER"] = "INMEMORY"
},
options =>
{
options.ControllerAssemblies.Add(typeof(MyController).Assembly);
});
await using (app)
{
var resp = await client.GetAsync("/healthz");
resp.EnsureSuccessStatusCode();
}
For more complex setups you can use a fluent builder:
using Archetypical.Software.Vega.Api.IntegrationTests.Framework.Hosting;
var (app, client) = await VegaTestHost.CreateBuilder()
.WithServiceName("MyService-IntegrationTests")
.AddConfiguration("VEGA:DBCONTEXT:PROVIDER", "SQLITE")
.AddConfiguration("VEGA:DBCONTEXT:CONNECTIONSTRING", "Data Source=:memory:")
.AddControllerAssembly(typeof(MyController).Assembly)
.WithEnsureCreated<MyDbContext>()
.StartAsync();
await using (app)
{
var resp = await client.GetAsync("/healthz");
resp.EnsureSuccessStatusCode();
}
If you need custom initialization (seeding data, schema, etc.), provide InitializeAsync:
options.InitializeAsync = async sp =>
{
using var scope = sp.CreateScope();
var db = scope.ServiceProvider.GetRequiredService<MyDbContext>();
await db.Database.EnsureCreatedAsync();
};
You can also reuse the built-in helper:
options.InitializeAsync = VegaTestHost.EnsureCreatedWithRetry<MyDbContext>(attempts: 10, delaySeconds: 2);
All fixtures inherit DockerFixtureBase and expose:
bool IsAvailablestring? UnavailableReasonUse SkipIfUnavailable.Docker(fixture) at the start of tests to skip/guard when Docker is not reachable.
using Archetypical.Software.Vega.Api.IntegrationTests.Framework.Fixtures;
using Archetypical.Software.Vega.Api.IntegrationTests.Framework.Utilities;
public class PostgresTests : IClassFixture<PostgresFixture>
{
private readonly PostgresFixture _fixture;
public PostgresTests(PostgresFixture fixture) => _fixture = fixture;
[Fact]
public async Task Works()
{
SkipIfUnavailable.Docker(_fixture);
var (app, client) = await VegaTestHost.StartAsync(
new Dictionary<string, string?>
{
["VEGA:DBCONTEXT:PROVIDER"] = "POSTGRESQL",
["VEGA:DBCONTEXT:CONNECTIONSTRING"] = _fixture.ConnectionString
},
options => options.ControllerAssemblies.Add(typeof(MyController).Assembly));
await using (app)
{
// ...
}
}
}
Optional configuration via builder:
var fixture = PostgresFixture.CreateBuilder()
.WithDatabase("vega")
.WithUsername("postgres")
.WithPassword("postgres")
.Build();
var fixture = CockroachFixture.CreateBuilder()
.WithDatabase("defaultdb")
.Build();
var fixture = SqlServerFixture.CreateBuilder()
.WithPassword("yourStrong(!)Password")
.Build();
var fixture = ClickhouseFixture.CreateBuilder()
.WithDatabase("default")
.WithReadyTimeoutSeconds(300)
.Build();
net9.0 and net10.0.SkipIfUnavailable.Docker(...) to avoid false negatives on CI/dev machines without Docker.dotnet test should be run against your test projects/solution; this package itself is not a test project.| 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 is compatible. 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 |
|---|---|---|
| 2.7.1 | 163 | 1/10/2026 |