public AteQualityModule( IFacadeService <AteFaultCode, string, AteFaultCodeResource, AteFaultCodeResource> ateFaultCodeService, IFacadeService <AteTest, int, AteTestResource, AteTestResource> ateTestService, IFacadeService <AteTestDetail, AteTestDetailKey, AteTestDetailResource, AteTestDetailResource> ateTestDetailService, IAteReportsFacadeService ateReportsFacadeService, ICountComponentsFacadeService countComponentsService) { this.ateFaultCodeService = ateFaultCodeService; this.ateTestService = ateTestService; this.ateTestDetailService = ateTestDetailService; this.ateReportsFacadeService = ateReportsFacadeService; this.countComponentsService = countComponentsService; this.Get("/production/quality/ate/fault-codes/{faultCode*}", parameters => this.GetFaultCodeById(parameters.faultCode)); this.Get("/production/quality/ate/fault-codes/", _ => this.GetAllFaultCodes()); this.Put("/production/quality/ate/fault-codes/{faultCode*}", parameters => this.UpdateFaultCode(parameters.faultCode)); this.Post("/production/quality/ate/fault-codes", _ => this.AddFaultCode()); this.Get("/production/quality/ate-tests/count-components/{partNumber*}", parameters => this.CountComponents(parameters.partNumber)); this.Get("/production/quality/ate-tests/create", _ => this.GetApp()); this.Get("/production/quality/ate-tests/{id}", parameters => this.GetTestById(parameters.id)); this.Get("/production/quality/ate-tests", _ => this.SearchAteTests()); this.Put("/production/quality/ate-tests/{id}", parameters => this.UpdateAteTest(parameters.id)); this.Post("/production/quality/ate-tests", _ => this.AddAteTest()); this.Get("/production/reports/ate/status", _ => this.GetApp()); this.Get("/production/reports/ate/status/report", _ => this.GetStatusReport()); this.Get("/production/reports/ate/details", _ => this.GetApp()); this.Get("/production/reports/ate/details/report", _ => this.GetDetailsReport()); }
public void EstablishContext() { this.AteFaultCodeService = Substitute.For <IFacadeService <AteFaultCode, string, AteFaultCodeResource, AteFaultCodeResource> >(); this.AteTestService = Substitute.For <IFacadeService <AteTest, int, AteTestResource, AteTestResource> >(); this.AteTestDetailService = Substitute.For <IFacadeService <AteTestDetail, AteTestDetailKey, AteTestDetailResource, AteTestDetailResource> >(); this.CountComponentsService = Substitute.For <ICountComponentsFacadeService>(); this.AteReportsFacadeService = Substitute.For <IAteReportsFacadeService>(); var bootstrapper = new ConfigurableBootstrapper( with => { with.Dependency(this.AteFaultCodeService); with.Dependency(this.AteTestService); with.Dependency(this.AteTestDetailService); with.Dependency(this.AteReportsFacadeService); with.Dependency(this.CountComponentsService); with.Dependency <IResourceBuilder <ResultsModel> >(new ResultsModelResourceBuilder()); with.Dependency <IResourceBuilder <AteFaultCode> >(new AteFaultCodeResourceBuilder()); with.Dependency <IResourceBuilder <IEnumerable <AteFaultCode> > >( new AteFaultCodesResourceBuilder()); with.Dependency <IResourceBuilder <AteTest> >(new AteTestResourceBuilder()); with.Dependency <IResourceBuilder <ComponentCount> >(new ComponentCountResourceBuilder()); with.Dependency <IResourceBuilder <IEnumerable <AteTest> > >(new AteTestsResourceBuilder()); with.Module <AteQualityModule>(); with.ResponseProcessor <AteFaultCodeResponseProcessor>(); with.ResponseProcessor <AteFaultCodesResponseProcessor>(); with.ResponseProcessor <ResultsModelJsonResponseProcessor>(); with.ResponseProcessor <AteTestResponseProcessor>(); with.ResponseProcessor <AteTestsResponseProcessor>(); with.ResponseProcessor <AteTestsResponseProcessor>(); with.ResponseProcessor <ComponentCountResponseProcessor>(); with.RequestStartup( (container, pipelines, context) => { var claims = new List <Claim> { new Claim(ClaimTypes.Role, "employee"), new Claim(ClaimTypes.NameIdentifier, "test-user") }; var user = new ClaimsIdentity(claims, "jwt"); context.CurrentUser = new ClaimsPrincipal(user); }); }); this.Browser = new Browser(bootstrapper); }