// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } ImpostersAsStubConfiguration stubConfiguration = new ImpostersAsStubConfiguration(new StubImpostersBuilder() .CreateStubImposters()); app.UseStubImposters(stubConfiguration); /*Uncomment below code when DynamoDB is available at http://localhost:8000*/ //ImpostersAsMockConfiguration mockConfiguration = // new ImpostersAsMockConfiguration(new MockImpostersBuilder() // .CreateMockImposters(), // new MocksDataStore() // .Create()); //app.UseMockImposters(mockConfiguration); app.UseMvc(); }
public StubbingRouteCreator( ImpostersAsStubConfiguration configuration, ImposterRulesEvaluator rulesEvaluator, IImposterRoute imposterRoute ) { _configuration = configuration; _rulesEvaluator = rulesEvaluator; _imposterRoute = imposterRoute; }
public static void UseStubImposters(this IApplicationBuilder applicationBuilder, ImpostersAsStubConfiguration impostersAsStubConfiguration) { var stubbingRouteCreator = new StubbingRouteCreator( impostersAsStubConfiguration, new ImposterRulesEvaluator(), new ImposterRoute() ); stubbingRouteCreator.CreateRoutes(applicationBuilder); }
public TestServerBuilder UsingImpostersMiddleware(Imposter imposter) { var impostersAsStubConfiguration = new ImpostersAsStubConfiguration(new[] { imposter }); Action <IApplicationBuilder> action = app => app.UseStubImposters(impostersAsStubConfiguration); _webHostBuilder.Configure(action); return(this); }