public void ConfigureServices(IServiceCollection services)
        {
            services.AddSession();
            services.AddSingleton <ISessionStore, SingletonSessionStore>();

            services.AddRouting();
            services.AddSignalR();

            services.AddSingleton <IUserInstanceStateStore, TestUserInstanceStateStore>();

            services
            .AddAuthentication("Test")
            .AddScheme <TestAuthenticationOptions, TestAuthenticationHandler>("Test", _ => { });

            services.AddCourseDirectory(HostingEnvironment, Configuration);

            services.AddMediatR(typeof(Startup));
            services.AddBehaviors(typeof(Startup).Assembly);

            services.AddSingleton <TestUserInfo>();
            services.AddSingleton <IDistributedCache, ClearableMemoryCache>();
            services.AddSingleton <IMptxStateProvider, InMemoryMptxStateProvider>();
            services.AddSingleton <IFeatureFlagProvider, ConfigurationFeatureFlagProvider>();
            services.Decorate <IFeatureFlagProvider, DataManagementFeatureFlagProvider>();
            services.Decorate <IFeatureFlagProvider, OverridableFeatureFlagProvider>();
            services.AddSingleton <Settings>();
            services.AddSingleton <ICookieSettingsProvider, TestCookieSettingsProvider>();
            services.AddTransient <DateValidationTestsValidator>();
            services.AddSingleton <IBackgroundWorkScheduler, ExecuteImmediatelyBackgroundWorkScheduler>();

            services.Configure <DataManagementOptions>(
                options => options.ProcessedImmediatelyThreshold = TimeSpan.FromMilliseconds(2000));

            DatabaseFixture.ConfigureServices(services);
        }
示例#2
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddSession();
            services.AddSingleton <ISessionStore, SingletonSessionStore>();

            services.AddRouting();

            services.AddSingleton <IUserInstanceStateStore, TestUserInstanceStateStore>();

            services
            .AddAuthentication("Test")
            .AddScheme <TestAuthenticationOptions, TestAuthenticationHandler>("Test", _ => { });

            services.AddCourseDirectory(HostingEnvironment, Configuration);

            services.AddMediatR(typeof(Startup));
            services.AddBehaviors(typeof(Startup).Assembly);

            services.AddSingleton <TestUserInfo>();
            services.AddSingleton <IDistributedCache, ClearableMemoryCache>();
            services.AddSingleton <IMptxStateProvider, InMemoryMptxStateProvider>();
            services.AddSingleton <IFeatureFlagProvider, ConfigurationFeatureFlagProvider>();
            services.Decorate <IFeatureFlagProvider, OverridableFeatureFlagProvider>();
            services.AddSingleton <Settings>();
            services.AddSingleton <ICookieSettingsProvider, TestCookieSettingsProvider>();
            services.AddTransient <ValidatorBaseTestsValidator>();

            DatabaseFixture.ConfigureServices(services);
        }