namespace Basket.FunctionalTests.Base { class BasketTestsStartup : Startup { public BasketTestsStartup(IConfiguration env) : base(env) { } public override IServiceProvider ConfigureServices(IServiceCollection services) { // Added to avoid the Authorize data annotation in test environment. // Property "SuppressCheckForUnhandledSecurityMetadata" in appsettings.json services.Configure(Configuration); return base.ConfigureServices(services); } protected override void ConfigureAuth(IApplicationBuilder app) { if (Configuration["isTest"] == bool.TrueString.ToLowerInvariant()) { app.UseMiddleware(); } else { base.ConfigureAuth(app); } } } }