![]() |
VOOZH | about |
dotnet add package Enhanced.Testing.Component.DbContext --version 1.2.4
NuGet\Install-Package Enhanced.Testing.Component.DbContext -Version 1.2.4
<PackageReference Include="Enhanced.Testing.Component.DbContext" Version="1.2.4" />
<PackageVersion Include="Enhanced.Testing.Component.DbContext" Version="1.2.4" />Directory.Packages.props
<PackageReference Include="Enhanced.Testing.Component.DbContext" />Project file
paket add Enhanced.Testing.Component.DbContext --version 1.2.4
#r "nuget: Enhanced.Testing.Component.DbContext, 1.2.4"
#:package Enhanced.Testing.Component.DbContext@1.2.4
#addin nuget:?package=Enhanced.Testing.Component.DbContext&version=1.2.4Install as a Cake Addin
#tool nuget:?package=Enhanced.Testing.Component.DbContext&version=1.2.4Install as a Cake Tool
This solution provides a set of harnesses for integrating various external components into your .NET testing environment. It simplifies the process of setting up and tearing down external dependencies such as databases, message brokers, and other services during testing.
The solution includes harnesses for the following components:
To use these testing components in your project, follow these steps:
Add Dependencies: Ensure your project references the Enhanced.Testing.Component namespace and its dependencies.
Configure Test Fixtures: Use the provided harnesses in your test fixtures for setting up and tearing down
external services. See the SampleServiceFixture class for an example.
Integration Testing: Write your integration tests using the configured fixtures to interact with real instances of your external dependencies.
Below is an example of how to set up a test fixture using the PostgreSQL harness:
public class MyServiceFixture : IAsyncLifetime
{
public HttpClientHarness HttpClient { get; private set; }
public PostgreSqlHarness PostgreSql { get; private set; }
public DbContextHarness<PeopleDbContext> PeopleDb { get; private set; }
private IComponent _component;
public MyServiceFixture()
{
HttpClient = new HttpClientHarness();
PostgreSql = new PostgreSqlHarness()
{
ConnectionName = "PeopleDb"
};
PeopleDb = new DbContextHarness<PeopleDbContext>
{
EnsureCreated = true
};
_component = ComponentBuilder.Create<Program>()
.AddHarness(HttpClient)
.AddHarness(PostgreSql)
.AddHarness(PeopleDb)
.Build();
}
public async Task InitializeAsync()
{
await _component.StartAsync();
}
public async Task DisposeAsync()
{
await _component.StopAsync();
}
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. 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.