/// <summary> /// Gets the max line width for all context lines and the matching line. /// </summary> /// <returns>The length of the longest string</returns> public int getMaxWidth() { if (mMaxWidth == -1) { int width = MatchLine.Text.Length; if (BeforeContext.Count > 0) { width = Math.Max(width, BeforeContext.Max(cl => cl.Text.Length)); } if (AfterContext.Count > 0) { width = Math.Max(width, AfterContext.Max(cl => cl.Text.Length)); } mMaxWidth = width; } return(mMaxWidth); }
public async Task before_each_and_after_each_is_called() { using (var host = SystemUnderTest .ForStartup <Startup>() .BeforeEach(c => { BeforeContext = c; }) .AfterEach(c => AfterContext = c)) { BeforeContext = AfterContext = null; await host.Scenario(_ => { _.Get.Url("/api/values"); }); AfterContext.ShouldNotBeNull(); BeforeContext.ShouldNotBeNull(); } }
public BeforeDataAccessEF7(BeforeContext dbContext) { _dbContext = dbContext; }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, SampleDataGenerator sampleData, BeforeContext context) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); // CORS support app.UseCors("before"); //app.UseApplicationInsightsRequestTelemetry(); if (env.IsDevelopment()) { app.UseBrowserLink(); app.UseDeveloperExceptionPage(); app.UseDatabaseErrorPage(); } else { app.UseExceptionHandler("/Home/Error"); // For more details on creating database during deployment see http://go.microsoft.com/fwlink/?LinkID=615859 //try //{ // using (var serviceScope = app.ApplicationServices.GetRequiredService<IServiceScopeFactory>() // .CreateScope()) // { // serviceScope.ServiceProvider.GetService<BeforeContext>() // .Database.Migrate(); // } //} //catch { } } app.UseIISPlatformHandler(options => options.AuthenticationDescriptions.Clear()); // Setup Cookie Authentication app.UseCookieAuthentication(options => { options.AccessDeniedPath = new PathString("/Home/AccessDenied"); }); //app.UseApplicationInsightsExceptionTelemetry(); app.UseStaticFiles(); app.UseIdentity(); // To configure external authentication please see http://go.microsoft.com/fwlink/?LinkID=532715 app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); // Add sample data and test admin accounts if specified in Config.Json. // for production applications, this should either be set to false or deleted. if (env.IsDevelopment() || env.IsEnvironment("Staging")) { context.Database.Migrate(); } if (Configuration["SampleData:InsertSampleData"] == "true") { sampleData.InsertTestData(); } //if (Configuration["SampleData:InsertTestUsers"] == "true") //{ // await sampleData.CreateAdminUser(); //} }
public override void Before(BeforeContext context) { //throw new NotImplementedException(); }