Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Overridden startup for integration test
/// <summary>
/// A startup class that bypasses oauth authentication for use in
/// integration tests and turns off application insights.
/// </summary>
public class LocalAuthStartup : Startup
{
public LocalAuthStartup(IConfiguration configuration) : base(configuration)
{
}
protected override void ConfigureAuth(IServiceCollection services)
{
// override the base jwt authentication with our local authorization.
// don't want a dependency on identity server under test
services.AddLocalAuthentication();
}
protected override void ConfigureAppInsights(IServiceCollection services)
{
// override the base implementation with nothing. We don't want
// telemetry under test
}
protected override void ConfigureDependencies(IServiceCollection services)
{
services.AddSingleton(new Mock<IDatabaseManager>(MockBehavior.Strict).Object);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment