public PhotoControllerTest()
        {
            var config = new Dictionary <string, string>()
            {
                ["settings"] = "value"
            };

            app = new AspApplicationMockBuilder(config).Build();
        }
Esempio n. 2
0
        public UsersTest()
        {
            var config = new Dictionary <string, string>()
            {
                ["SettingsExamle"] = "value"
            };

            app = new AspApplicationMockBuilder(config).Build();
            // Use builder to configure services:
            // builder.Services.AddTransient<...>();
            // app = builder.Build();
        }
Esempio n. 3
0
        public AnalyticsAgentTest()
        {
            var config = new Dictionary <string, string>()
            {
                ["AnalyticsPollingTimeout"]             = "1000",
                ["AnalyticsPollingTimeoutBetweenTasks"] = "1000",
                ["PhotoUploadTryCount"] = "5"
            };

            app           = new AspApplicationMockBuilder(config).Build();
            configuration = app.ServiceProvider.GetRequiredService <IConfiguration>();
        }
Esempio n. 4
0
        public PhotoControllerTests()
        {
            var config = new Dictionary <string, string>()
            {
                ["SessionTimeout"]       = "00:01:00",
                ["TimeoutCheckInterval"] = "00:00:01",
                ["ModelName"]            = "1"
            };

            app  = new AspApplicationMockBuilder(config).Build();
            conf = app.ServiceProvider.GetRequiredService <IConfiguration>();
        }
Esempio n. 5
0
        public AspApplicationMock Build()
        {
            var app = new AspApplicationMock();

            app.HttpContext = new DefaultHttpContext();

            app.HttpContext.Features.Set <IHttpAuthenticationFeature>(new HttpAuthenticationFeature());
            Services.AddSingleton <IHttpContextAccessor>(h => new HttpContextAccessor
            {
                HttpContext = app.HttpContext
            });

            var serviceProvider = Services.BuildServiceProvider();

            app.UserManager     = serviceProvider.GetRequiredService <UserManager <ApplicationUser> >();
            app.RoleManager     = serviceProvider.GetRequiredService <RoleManager <ApplicationRole> >();
            app.SignInManager   = serviceProvider.GetRequiredService <SignInManager <ApplicationUser> >();
            app.IdentityOptions = serviceProvider.GetRequiredService <IOptions <IdentityOptions> >();
            app.ServiceProvider = serviceProvider;

            return(app);
        }
 public PhotoControllerGetPhotoTest()
 {
     app = new AspApplicationMockBuilder(null).Build();
 }