Pemvedr.Common.TestUtilities.AspNetCore 0.1.20240401.1

#«»

Structure

Examples

Basic with defaults

Create a new class to specify the CreateHostMethod

public static class OurTestServerBuilder
{
	public static TestServerBuilder AnInstance
		=> TestServerBuilder.ATestServer.WithHostBuilder(() => Program.CreateHostBuilder(new string[0]));
}

After that create tests with it

using Microsoft.AspNetCore.TestHost;

[Fact]
public async Task TestName(){
	var sut = OurTestServerBuilder.AnInstance.Build();
	var httpResponse = await sut.GetTestClient().GetAsync("/«route»");
	...
}

Optionally add mocked services

OurTestServerBuilder.AnInstance.WithServiceMock(provider => ...);

Development hints

none

See also

No packages depend on Pemvedr.Common.TestUtilities.AspNetCore.

Version Downloads Last updated
0.1.20241126.2 5 11/26/2024
0.1.20241125.1 5 11/25/2024
0.1.20241117.2 6 11/17/2024
0.1.20241030.1 6 10/30/2024
0.1.20240903.1 6 09/02/2024
0.1.20240620.2 6 06/20/2024
0.1.20240602.1 7 06/02/2024
0.1.20240425.1 5 04/25/2024
0.1.20240409.1 5 04/09/2024
0.1.20240401.1 5 04/01/2024
0.1.20240210.1 6 02/09/2024
0.1.20240122.2 5 01/22/2024
0.1.20220327.1 6 05/15/2022
0.1.20220212.1 7 05/15/2022
0.1.20210912.1 6 05/15/2022