Enhanced.Testing.Component 1.2.3

dotnet add package Enhanced.Testing.Component --version 1.2.3                
NuGet\Install-Package Enhanced.Testing.Component -Version 1.2.3                
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="Enhanced.Testing.Component" Version="1.2.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Enhanced.Testing.Component --version 1.2.3                
#r "nuget: Enhanced.Testing.Component, 1.2.3"                
#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.
// Install Enhanced.Testing.Component as a Cake Addin
#addin nuget:?package=Enhanced.Testing.Component&version=1.2.3

// Install Enhanced.Testing.Component as a Cake Tool
#tool nuget:?package=Enhanced.Testing.Component&version=1.2.3                

Enhanced.Testing.Component

NuGet

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.

Harnesses

The solution includes harnesses for the following components:

  • PostgreSQL: Facilitates the setup of a PostgreSQL database container for integration testing. NuGet
  • Redis: Provides support for both Redis and RedisStack, allowing for easy integration of Redis services into your tests. NuGet
  • Kafka: A harness for setting up a Kafka broker for message-based integration testing. NuGet
  • gRPC Client: Simplifies the process of testing gRPC services by providing a client harness. NuGet
  • HTTP Client: Offers a harness for testing HTTP-based services and APIs. NuGet

Getting Started

To use these testing components in your project, follow these steps:

  1. Add Dependencies: Ensure your project references the Enhanced.Testing.Component namespace and its dependencies.

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

  3. Integration Testing: Write your integration tests using the configured fixtures to interact with real instances of your external dependencies.

Example Usage

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 Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (5)

Showing the top 5 NuGet packages that depend on Enhanced.Testing.Component:

Package Downloads
Enhanced.Testing.Component.PostgreSql

Enhanced.Testing.Component is a NuGet package that provides a set of tools for component testing ASP.NET Core applications.

Enhanced.Testing.Component.GrpcClient

Enhanced.Testing.Component is a NuGet package that provides a set of tools for component testing ASP.NET Core applications.

Enhanced.Testing.Component.DbContext

Enhanced.Testing.Component is a NuGet package that provides a set of tools for component testing ASP.NET Core applications.

Enhanced.Testing.Component.Kafka

Enhanced.Testing.Component is a NuGet package that provides a set of tools for component testing ASP.NET Core applications.

Enhanced.Testing.Component.Redis

Enhanced.Testing.Component is a NuGet package that provides a set of tools for component testing ASP.NET Core applications.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.3 155 10/18/2024
1.2.2 175 8/7/2024
1.2.1 101 8/4/2024
1.2.0 135 8/1/2024
1.1.1 131 7/22/2024
1.1.0 143 7/21/2024
1.0.1 146 7/16/2024
1.0.0 125 6/12/2024