public override void SetUp() { base.SetUp(); var helper = new DataSeedHelper(DatabaseName); helper.CreateStateEducationAgency(StateEducationAgencyId); helper.CreateLocalEducationAgency(Lea1Id, StateEducationAgencyId); helper.CreateLocalEducationAgency(Lea2Id, StateEducationAgencyId); helper.CreateLocalEducationAgency(Lea3Id, StateEducationAgencyId); helper.CreateSchool(School1Id, Lea1Id); helper.CreateSchool(School2Id, Lea2Id); helper.CreateSchool(School3Id, Lea3Id); }
private static void SeedTestData(ApplicationInitializationContext context) { DataSeedHelper.Seed(context); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure( IApplicationBuilder app, IWebHostEnvironment env, DataSeedHelper dataSeed, ILogger <AuditLog> logger) { Audit.Core.Configuration.Setup() .UseDynamicProvider(configurator => { configurator.OnInsert(audit => AuditUtilities.LogAuditEvent(audit, logger)); configurator.OnReplace((obj, audit) => AuditUtilities.LogAuditEvent(audit, logger)); }); dataSeed.Initialize(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseExceptionHandler("/Error"); app.UseHsts(); } app.UseSerilogRequestLogging(options => { options.MessageTemplate = "HTTP {RequestMethod} {RequestPath} by user: {User} responded {StatusCode} in {Elapsed:0.0000} ms"; options.EnrichDiagnosticContext = (context, httpContext) => { context.Set("User", httpContext.User?.Identity.Name); context.Set("UserId", httpContext.User?.FindFirst("UserId")?.Value); }; }); app.UseStaticFiles(); app.UseSpaStaticFiles(); app.UseMiddleware <AuditMiddleware>(); // Add Swagger json and ui var swaggerUrl = "api/swagger/{documentName}/openapi.json"; app.UseSwagger(options => { options.RouteTemplate = swaggerUrl; }); app.UseSwaggerUI(options => { options.SwaggerEndpoint("/api/swagger/json/openapi.json", "Lactalis"); options.RoutePrefix = "api/swagger"; }); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllerRoute("default", "{controller}/{action=Index}/{id?}"); }); app.UseSpa(spa => { spa.Options.SourcePath = "Client"; if (env.IsDevelopment()) { var clientServerSettings = Configuration.GetSection("ClientServerSettings"); spa.Options.SourcePath = clientServerSettings["ClientSourcePath"]; bool.TryParse(clientServerSettings["UseProxyServer"], out var useProxyServer); if (useProxyServer) { spa.UseProxyToSpaDevelopmentServer(clientServerSettings["ProxyServerAddress"]); } else { spa.UseReactDevelopmentServer("start"); } } }); }