public PhotoControllerTest() { var config = new Dictionary <string, string>() { ["settings"] = "value" }; app = new AspApplicationMockBuilder(config).Build(); }
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(); }
public AnalyticsAgentTest() { var config = new Dictionary <string, string>() { ["AnalyticsPollingTimeout"] = "1000", ["AnalyticsPollingTimeoutBetweenTasks"] = "1000", ["PhotoUploadTryCount"] = "5" }; app = new AspApplicationMockBuilder(config).Build(); configuration = app.ServiceProvider.GetRequiredService <IConfiguration>(); }
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>(); }
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(); }