Skip to content

Instantly share code, notes, and snippets.

@ankitvijay
Last active January 3, 2020 21:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ankitvijay/bad3612b9c157e2e398efc2965d6a999 to your computer and use it in GitHub Desktop.
Save ankitvijay/bad3612b9c157e2e398efc2965d6a999 to your computer and use it in GitHub Desktop.
Integration Tests - Approach 2 (Project AWS.IntegrationTests)
public class TestStartup : Common.IntegrationTests.TestStartup
{
public override IServiceProvider ConfigureServices(IServiceCollection services)
{
var configuration = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("appsettings.aws.json", false)
.AddEnvironmentVariables()
.Build();
services.AddMvc()
.SetCompatibilityVersion(version: CompatibilityVersion.Version_2_2);
// Code to add required services based on configuration
return services.BuildServiceProvider();
}
}
public class TestServerFixture : Fixtures.TestServerFixture
{
public TestServerFixture() : base(new TestStartup())
{
}
}
public class MyTest : Common.IntegrationTests.MyTests, IClassFixture<TestServerFixture>
{
public MyTest(TestServerFixture fixture) : base(fixture)
{
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment