Custom Web Application Factory
The ShiftSoftware.ShiftFrameworkTestingTools
package provides a custom WebApplicationFactory called ShiftCustomWebApplicationFactory<TStartup, DB>
that can be used for integration testing against the API project.
ShiftCustomWebApplicationFactory<WebMarker, DB>¶
public class CustomWebApplicationFactory :
ShiftCustomWebApplicationFactory<WebMarker, DB>
{
public CustomWebApplicationFactory() : base(
"SQLServer_Test",
new ShiftCustomWebApplicationBearerAuthSettings
{
Enabled = true,
TokenKeySettingKey = "Settings:TokenSettings:Key",
TokenIssuerSettingKey = "Settings:TokenSettings:Issuer",
TypeAuthActions = new List<Type>()
{
typeof(StockActionTrees)
}
})
{ }
}
App Settings¶
The constructor reads from appsettings. Below is a sample appsettings.json
that should exist in the test project.