Microsoft.AspNetCore.TestHost 11.0.0-rc.1.26425.128

About

Microsoft.AspNetCore.TestHost provides an ASP.NET Core web server for testing middleware in isolation.

Key Features

  • Instantiate an app pipeline containing only the components that you need to test
  • Send custom requests to verify middleware behavior

How to Use

To use Microsoft.AspNetCore.TestHost, follow these steps:

Installation

dotnet add package Microsoft.AspNetCore.TestHost

Usage

To set up the TestServer, configure it in your test project. Here's an example:

[Fact]
public async Task MiddlewareTest_ReturnsNotFoundForRequest()
{
    // Build and start a host that uses TestServer
    using var host = await new HostBuilder()
        .ConfigureWebHost(builder =>
        {
            builder.UseTestServer()
                .ConfigureServices(services =>
                {
                    // Add any required services that the middleware uses
                    services.AddMyServices();
                })
                .Configure(app =>
                {
                    // Configure the processing pipeline to use the middleware
                    // for the test
                    app.UseMiddleware<MyMiddleware>();
                });
        })
        .StartAsync();

    var response = await host.GetTestClient().GetAsync("/");

    Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
}

Main Types

The main types provided by this package are:

  • TestServer: An IServer implementation for executing tests
  • TestServerOptions: Provides options for configuring a TestServer

Additional Documentation

For additional documentation and examples, refer to the official documentation for testing middleware in ASP.NET Core.

Feedback & Contributing

Microsoft.AspNetCore.TestHost is released as open-source under the MIT license. Bug reports and contributions are welcome at the GitHub repository.

Showing the top 20 packages that depend on Microsoft.AspNetCore.TestHost.

Packages Downloads
Alpata.BaseUnitTests
Test projesi için kullanılır Testlerin sıralanabilmesi için Order attribute desteği sağlar Test sunucusunu çalıştırarak otomatik servis testini yapar
46
Alpata.BaseUnitTests
Test projesi için kullanılır Testlerin sıralanabilmesi için Order attribute desteği sağlar Test sunucusunu çalıştırarak otomatik servis testini yapar
87
Alpata.BaseUnitTests
Test projesi için kullanılır Testlerin sıralanabilmesi için Order attribute desteği sağlar Test sunucusunu çalıştırarak otomatik servis testini yapar
91
Alpata.BaseUnitTests
Test projesi için kullanılır Testlerin sıralanabilmesi için Order attribute desteği sağlar Test sunucusunu çalıştırarak otomatik servis testini yapar
144
Microsoft.AspNetCore.Mvc.Testing
Support for writing functional tests for MVC applications. This package was built from the source code at https://github.com/aspnet/AspNetCore/tree/2b7e994b8a304700a09617ffc5052f0d943bbcba
35
Microsoft.AspNetCore.Mvc.Testing
Support for writing functional tests for MVC applications. This package was built from the source code at https://github.com/aspnet/AspNetCore/tree/4d0b3722384bfec7d4c210674df9b7bf1e59da90
37
Microsoft.AspNetCore.Mvc.Testing
Support for writing functional tests for MVC applications. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/2924ca229b3d6c91b7c9eded119b31dfd7aa1fef
37
Microsoft.AspNetCore.Mvc.Testing
Support for writing functional tests for MVC applications. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/54e8b61777d42d2b10744d1987438ee5b8c0b24d
35
Microsoft.AspNetCore.Mvc.Testing
Support for writing functional tests for MVC applications. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/610fe433e07b32ed451ed99d07df63be47c29050
34
Microsoft.AspNetCore.Mvc.Testing
Support for writing functional tests for MVC applications. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/88ca061d20b28892b28279b17bad46919cff49a4
35
Microsoft.AspNetCore.Mvc.Testing
Support for writing functional tests for MVC applications. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/88ec3bc3f37e76fbcc932a25f9f0c1c29fe2b343
34
Microsoft.AspNetCore.Mvc.Testing
Support for writing functional tests for MVC applications. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/8ad057426fa6a27cd648b05684afddab9d97d3d9
36
Microsoft.AspNetCore.Mvc.Testing
Support for writing functional tests for MVC applications. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/cccab50fba1c7335fdb48a735246374b5ddd7e69
37
Microsoft.AspNetCore.Mvc.Testing
Support for writing functional tests for MVC applications. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/da7e9894ce22ef8cc02e5acc56e95a6f8cf8f644
35
Microsoft.AspNetCore.Mvc.Testing
Support for writing functional tests for MVC applications. This package was built from the source code at https://github.com/dotnet/aspnetcore/tree/e0d900c8649d185cf925b59bc12187a116e5e114
38
NSwag.Commands
NSwag: The OpenAPI/Swagger API toolchain for .NET and TypeScript
35
NSwag.Commands
NSwag: The OpenAPI/Swagger API toolchain for .NET and TypeScript
37
NSwag.Commands
NSwag: The Swagger API toolchain for .NET and TypeScript
34
NSwag.Commands
NSwag: The Swagger API toolchain for .NET and TypeScript
36
NSwag.Commands
NSwag: The Swagger API toolchain for .NET and TypeScript
37

.NET 11.0

  • No dependencies.

Version Downloads Last updated
11.0.0-rc.1.26425.128 3 09/11/2026
11.0.0-preview.7.26381.103 2 08/12/2026
11.0.0-preview.6.26359.118 10 07/22/2026
11.0.0-preview.5.26302.115 10 06/17/2026
11.0.0-preview.4.26230.115 16 05/18/2026
11.0.0-preview.3.26207.106 6 04/15/2026
11.0.0-preview.2.26159.112 13 03/11/2026
11.0.0-preview.1.26104.118 15 02/17/2026
10.0.12 2 09/18/2026
10.0.11 2 08/12/2026
10.0.10 5 07/22/2026
10.0.9 11 06/16/2026
10.0.8 10 05/19/2026
10.0.7 5 04/24/2026
10.0.6 11 04/16/2026
10.0.5 11 03/15/2026
10.0.4 8 03/11/2026
10.0.3 8 02/18/2026
10.0.2 13 01/14/2026
10.0.1 17 12/12/2025
10.0.0 22 11/13/2025
10.0.0-rc.2.25502.107 13 10/18/2025
10.0.0-rc.1.25451.107 21 09/10/2025
10.0.0-preview.7.25380.108 20 08/16/2025
10.0.0-preview.6.25358.103 15 07/16/2025
10.0.0-preview.5.25277.114 16 06/26/2025
10.0.0-preview.4.25258.110 25 05/16/2025
10.0.0-preview.3.25172.1 16 04/29/2025
10.0.0-preview.2.25164.1 30 03/26/2025
10.0.0-preview.1.25120.3 23 02/25/2025
9.0.20 2 09/18/2026
9.0.19 3 08/12/2026
9.0.18 4 07/22/2026
9.0.17 15 06/16/2026
9.0.16 6 05/19/2026
9.0.15 6 04/24/2026
9.0.14 11 03/11/2026
9.0.13 10 02/18/2026
9.0.12 11 01/14/2026
9.0.11 18 11/13/2025
9.0.10 20 10/19/2025
9.0.9 20 09/11/2025
9.0.8 26 08/09/2025
9.0.7 22 07/12/2025
9.0.6 26 06/26/2025
9.0.5 33 05/16/2025
9.0.4 30 04/29/2025
9.0.3 28 03/26/2025
9.0.2 30 02/25/2025
9.0.1 34 01/18/2025
9.0.0 27 01/18/2025
9.0.0-rc.2.24474.3 23 01/16/2025
9.0.0-rc.1.24452.1 20 02/26/2025
9.0.0-preview.7.24406.2 20 02/26/2025
9.0.0-preview.6.24328.4 25 10/06/2024
9.0.0-preview.5.24306.11 18 10/22/2024
9.0.0-preview.4.24267.6 26 02/26/2025
9.0.0-preview.3.24172.13 21 10/05/2024
9.0.0-preview.2.24128.4 29 03/28/2024
9.0.0-preview.1.24081.5 29 03/10/2024
8.0.31 2 09/18/2026
8.0.30 3 08/12/2026
8.0.29 6 07/22/2026
8.0.28 7 06/16/2026
8.0.27 5 05/19/2026
8.0.26 8 04/24/2026
8.0.25 15 03/11/2026
8.0.24 10 02/18/2026
8.0.23 9 01/14/2026
8.0.22 16 11/13/2025
8.0.21 13 10/19/2025
8.0.20 22 09/11/2025
8.0.19 19 08/09/2025
8.0.18 14 07/12/2025
8.0.17 19 06/29/2025
8.0.16 22 05/16/2025
8.0.15 26 04/29/2025
8.0.14 20 03/26/2025
8.0.13 20 02/25/2025
8.0.12 25 01/18/2025
8.0.11 24 02/25/2025
8.0.10 20 01/09/2025
8.0.8 30 02/25/2025
8.0.7 27 12/08/2024
8.0.6 35 02/25/2025
8.0.5 31 10/02/2024
8.0.4 29 02/25/2025
8.0.3 32 03/28/2024
8.0.2 31 03/01/2024
8.0.1 41 03/02/2024
8.0.0 45 03/01/2024
8.0.0-rc.2.23480.2 22 10/31/2023
8.0.0-rc.1.23421.29 22 02/26/2025
8.0.0-preview.7.23375.9 24 03/10/2024
8.0.0-preview.6.23329.11 25 03/03/2024
8.0.0-preview.5.23302.2 25 03/11/2024
8.0.0-preview.4.23260.4 21 03/04/2024
8.0.0-preview.3.23177.8 23 03/02/2024
8.0.0-preview.2.23153.2 20 03/02/2024
8.0.0-preview.1.23112.2 22 03/09/2024
7.0.20 18 02/25/2025
7.0.19 19 02/25/2025
7.0.18 26 02/25/2025
7.0.17 30 03/28/2024
7.0.16 26 03/01/2024
7.0.15 29 03/04/2024
7.0.14 24 02/08/2024
7.0.13 27 11/04/2023
7.0.12 22 03/05/2024
7.0.11 25 11/28/2023
7.0.10 28 08/24/2023
7.0.9 29 11/05/2023
7.0.8 36 03/09/2024
7.0.7 34 11/05/2023
7.0.5 30 08/18/2023
7.0.4 33 08/18/2023
7.0.3 34 08/18/2023
7.0.2 48 08/18/2023
7.0.1 44 08/18/2023
7.0.0 66 08/18/2023
7.0.0-rc.2.22476.2 25 11/07/2023
7.0.0-rc.1.22427.2 31 02/27/2024
7.0.0-preview.7.22376.6 24 03/10/2024
7.0.0-preview.6.22330.3 18 02/25/2025
7.0.0-preview.5.22303.8 22 03/10/2024
7.0.0-preview.4.22251.1 25 03/02/2024
7.0.0-preview.3.22178.4 24 03/04/2024
7.0.0-preview.2.22153.2 34 03/06/2024
7.0.0-preview.1.22109.13 23 03/06/2024
6.0.36 23 01/18/2025
6.0.35 19 12/24/2024
6.0.33 23 02/25/2025
6.0.32 27 10/19/2024
6.0.31 18 01/04/2025
6.0.30 22 02/25/2025
6.0.29 27 12/12/2024
6.0.28 19 03/28/2024
6.0.27 25 03/12/2024
6.0.26 21 03/12/2024
6.0.25 24 03/13/2024
6.0.24 28 01/03/2024
6.0.23 31 11/03/2023
6.0.22 28 01/04/2024
6.0.21 23 11/06/2023
6.0.20 31 11/04/2023
6.0.19 29 03/04/2024
6.0.18 28 01/08/2024
6.0.16 21 01/25/2024
6.0.15 17 02/25/2025
6.0.14 29 11/06/2023
6.0.13 17 11/03/2023
6.0.12 20 03/03/2024
6.0.11 27 03/04/2024
6.0.10 28 08/18/2023
6.0.9 40 08/18/2023
6.0.8 37 03/04/2024
6.0.7 39 11/09/2023
6.0.6 27 11/04/2023
6.0.5 39 01/28/2024
6.0.4 28 03/02/2024
6.0.3 66 08/18/2023
6.0.2 34 08/18/2023
6.0.1 31 03/02/2024
6.0.0 26 03/03/2024
6.0.0-rc.2.21480.10 22 03/17/2024
6.0.0-rc.1.21452.15 21 03/16/2024
6.0.0-preview.7.21378.6 26 03/10/2024
6.0.0-preview.6.21355.2 24 03/14/2024
6.0.0-preview.5.21301.17 20 03/16/2024
6.0.0-preview.4.21253.5 21 03/11/2024
6.0.0-preview.3.21201.13 17 03/03/2024
6.0.0-preview.2.21154.6 20 03/16/2024
6.0.0-preview.1.21103.6 25 03/08/2024
5.0.17 30 11/04/2023
5.0.16 33 11/04/2023
5.0.15 30 03/08/2024
5.0.14 27 03/04/2024
5.0.13 21 03/06/2024
5.0.12 28 11/07/2023
5.0.11 25 03/06/2024
5.0.10 27 03/04/2024
5.0.9 31 03/04/2024
5.0.8 32 03/06/2024
5.0.7 33 03/06/2024
5.0.6 27 03/06/2024
5.0.5 26 03/06/2024
5.0.4 37 03/06/2024
5.0.3 37 03/03/2024
5.0.2 41 11/04/2023
5.0.1 25 03/03/2024
5.0.0 29 03/03/2024
5.0.0-rc.2.20475.17 30 03/14/2024
5.0.0-rc.1.20451.17 20 02/22/2025
5.0.0-preview.8.20414.8 27 03/10/2024
5.0.0-preview.7.20365.19 22 03/11/2024
5.0.0-preview.6.20312.15 22 03/10/2024
5.0.0-preview.5.20279.2 30 03/02/2024
5.0.0-preview.4.20257.10 20 02/26/2025
5.0.0-preview.3.20215.14 27 11/11/2023
5.0.0-preview.2.20167.3 25 03/14/2024
5.0.0-preview.1.20124.5 28 03/10/2024
3.1.32 22 03/02/2024
3.1.31 22 03/03/2024
3.1.30 24 11/16/2023
3.1.29 25 03/04/2024
3.1.28 29 03/04/2024
3.1.27 28 11/04/2023
3.1.26 22 03/04/2024
3.1.25 31 11/06/2023
3.1.24 26 03/05/2024
3.1.23 29 03/05/2024
3.1.22 22 03/04/2024
3.1.21 19 11/02/2023
3.1.20 27 03/04/2024
3.1.19 19 11/06/2023
3.1.18 21 11/06/2023
3.1.17 24 03/03/2024
3.1.16 25 11/02/2023
3.1.15 26 03/03/2024
3.1.14 31 03/04/2024
3.1.13 27 11/06/2023
3.1.12 30 03/04/2024
3.1.11 26 08/18/2023
3.1.10 21 03/04/2024
3.1.9 31 03/04/2024
3.1.8 28 03/03/2024
3.1.7 29 03/04/2024
3.1.6 26 03/04/2024
3.1.5 26 03/04/2024
3.1.4 40 08/18/2023
3.1.3 24 03/03/2024
3.1.2 32 03/04/2024
3.1.1 24 03/03/2024
3.1.0 30 03/02/2024
3.1.0-preview3.19555.2 24 03/03/2024
3.1.0-preview2.19528.8 24 03/10/2024
3.1.0-preview1.19508.20 19 03/03/2024
3.0.3 25 03/04/2024
3.0.2 38 03/04/2024
3.0.0 28 03/03/2024
3.0.0-rc1.19457.4 28 03/09/2024
3.0.0-preview9.19424.4 26 03/10/2024
3.0.0-preview8.19405.7 30 03/03/2024
3.0.0-preview7.19365.7 24 03/10/2024
3.0.0-preview6.19307.2 28 03/02/2024
3.0.0-preview5-19227-01 20 03/09/2024
3.0.0-preview4-19216-03 21 01/18/2025
3.0.0-preview3-19153-02 24 03/04/2024
3.0.0-preview-19075-0444 19 01/18/2025
3.0.0-preview-18579-0056 27 03/10/2024
2.3.13 2 09/18/2026
2.3.12 3 08/12/2026
2.3.11 13 06/16/2026
2.3.10 13 05/19/2026
2.3.9 15 01/12/2026
2.3.8 9 01/12/2026
2.3.0 40 01/18/2025
2.2.0 29 12/04/2023
2.2.0-preview3-35497 27 03/10/2024
2.2.0-preview2-35157 25 11/04/2023
2.2.0-preview1-35029 29 03/02/2024
2.1.1 33 03/04/2024
2.1.0 37 03/02/2024
2.1.0-rc1-final 28 03/04/2024
2.1.0-preview2-final 31 03/06/2024
2.1.0-preview1-final 31 03/04/2024
2.0.3 37 03/04/2024
2.0.2 29 03/04/2024
2.0.1 33 11/03/2023
2.0.0 33 12/05/2023
2.0.0-preview2-final 25 03/02/2024
2.0.0-preview1-final 25 03/26/2024
1.1.3 32 03/02/2024
1.1.2 24 03/05/2024
1.1.1 35 03/03/2024
1.1.0 27 03/04/2024
1.1.0-preview1-final 29 03/06/2024
1.0.5 28 03/03/2024
1.0.4 35 03/04/2024
1.0.3 26 03/04/2024
1.0.2 33 01/27/2024
1.0.1 30 11/05/2023
1.0.0 27 01/14/2024
1.0.0-rc2-final 25 03/04/2024