You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 19, 2018. It is now read-only.
The intention is to avoid creating a separate TestStartUp class rather - rather inject an instance of Configuration
Sample start up below,
public class Startup
{
public IConfiguration Configuration {get; set;}
public void Startup()
{
Configuration = new ConfigurationBuilder()
.AddEnvironmentVariables()
.Build();
}
public void ConfigureServices(IServiceCollection services)
{
//uses Configuration object to set up everything
}
}
In the above implementation, if only
TestServer.CreateBuilder().UseStartup(instanceOfStartup)
is permitted
I can do this,
Startup instanceOfStartup= new Startup();
instanceOfStartup.Configuration = myOwnconfigurationWithKeysRequiredForTest;
//create a test server with
TestServer.CreateBuilder().UseStartup(instanceOfStartup)
Advantage: I dont have to maintain multiple startup class.