RouteTester.AspNetCore 7.0.1

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

// Install RouteTester.AspNetCore as a Cake Tool
#tool nuget:?package=RouteTester.AspNetCore&version=7.0.1                

RouteTester.AspNetCore Build Coverage

NuGet Package

Install-Package RouteTester.AspNetCore

Example

public class Example
{
    private readonly TestApplicationFactory _factory = new();

    [Fact]
    public async Task CanRoute()
    {
        await RouteAssert.ForAsync(
            _server,
            request => request.WithPathAndQuery("/some-route"),
            assert => assert.MapsTo<HomeController>(a => a.SomeRoute()));
    }

    [Fact]
    public async Task CanRouteWithArguments()
    {
        await RouteAssert.ForAsync(
            _server,
            request => request.WithPathAndQuery("/some-other-route?parameter=value"),
            assert => assert.MapsTo<HomeController>(a => a.SomeOtherRoute("value")));
    }
}

public class TestApplicationFactory : WebApplicationFactory<Program>
{
    protected override IWebHostBuilder? CreateWebHostBuilder()
    {
        var builder = new WebHostBuilder();
        builder.UseStartup<TestStartup>();

        return builder;
    }

    private sealed class TestStartup
    {
        public static void ConfigureServices(IServiceCollection serviceCollection)
        {
            serviceCollection
                .AddMvc()
                .AddApplicationPart(typeof(Program).Assembly);
            serviceCollection.MvcRouteTester();
        }

        public static void Configure(IApplicationBuilder app)
        {
            app.UseRouting();

            app.UseEndpoints(x =>
            {
                x.MapControllers();
            });
        }
    }
}
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
7.0.1 351 2/8/2023
7.0.0 239 2/8/2023