Soenneker.StartupFilters.IntegrationTests 11.0.151

Prefix Reserved
dotnet add package Soenneker.StartupFilters.IntegrationTests --version 11.0.151
                    
NuGet\Install-Package Soenneker.StartupFilters.IntegrationTests -Version 11.0.151
                    
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="Soenneker.StartupFilters.IntegrationTests" Version="11.0.151" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.StartupFilters.IntegrationTests" Version="11.0.151" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.StartupFilters.IntegrationTests" />
                    
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 Soenneker.StartupFilters.IntegrationTests --version 11.0.151
                    
#r "nuget: Soenneker.StartupFilters.IntegrationTests, 11.0.151"
                    
#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 Soenneker.StartupFilters.IntegrationTests@11.0.151
                    
#: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=Soenneker.StartupFilters.IntegrationTests&version=11.0.151
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.StartupFilters.IntegrationTests&version=11.0.151
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

Soenneker.StartupFilters.IntegrationTests

An ASP.NET Core startup filter that makes in-memory integration-test requests appear to originate from the loopback address.

Installation

dotnet add package Soenneker.StartupFilters.IntegrationTests

Usage with WebApplicationFactory

using Microsoft.AspNetCore.Mvc.Testing;
using Soenneker.StartupFilters.IntegrationTests.Registrars;

await using var factory = new WebApplicationFactory<Program>()
    .WithWebHostBuilder(builder =>
    {
        builder.ConfigureServices(services =>
        {
            services.AddIntegrationTestsStartupFilterAsSingleton();
        });
    });

using HttpClient client = factory.CreateClient();
HttpResponseMessage response = await client.GetAsync("/health");

The filter inserts LocalIpAddressMiddleware before the application's configured pipeline. For every request, that middleware sets both HttpContext.Connection.LocalIpAddress and RemoteIpAddress to IPAddress.Loopback. This is useful when code under test requires connection-address data that an in-memory test server does not provide.

Test-only safety

Do not register this package in production. Replacing RemoteIpAddress can bypass application behavior that trusts loopback traffic, including IP allowlists or local-only endpoints. Keep the registration inside the integration-test host configuration rather than shared application startup.

The singleton registration is the normal choice because startup filters are consumed while the host builds its middleware pipeline. The scoped registrar is available for specialized hosts, but it is not needed for a standard WebApplicationFactory setup.

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Soenneker.StartupFilters.IntegrationTests:

Package Downloads
Soenneker.Fixtures.Integration

Provides a reusable and generic integration test xunit fixture that dynamically registers and configures WebApplicationFactory instances for multiple ASP.NET Core projects with support for custom app settings, authentication, logging, and test utilities.

Soenneker.TestHosts.Integration

Provides a reusable and generic integration test host that dynamically registers and configures WebApplicationFactory instances for multiple ASP.NET Core projects with support for custom app settings, authentication, logging, and test utilities.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
11.0.151 263 11/11/2026
11.0.150 49 11/11/2026
11.0.149 352 11/4/2026
11.0.148 396 10/27/2026
11.0.147 107 10/27/2026
11.0.146 145 10/26/2026
11.0.145 126 10/26/2026
11.0.144 189 10/26/2026
11.0.143 103 10/26/2026
4.0.142 475 10/14/2026
4.0.141 182 10/14/2026
4.0.140 96 10/14/2026
4.0.139 139 10/14/2026
4.0.134 165 10/13/2026
4.0.133 116 10/13/2026
4.0.132 95 10/12/2026
4.0.130 323 10/11/2026
4.0.129 868 9/24/2026
4.0.128 116 9/24/2026
4.0.127 551 9/15/2026
Loading failed

Update dependency Soenneker.Middlewares.LocalIpAddress to 11.0.85 (#760)