public WorksOrdersModule( IOutstandingWorksOrdersReportFacade outstandingWorksOrdersReportFacade, IFacadeService <WorksOrderLabel, WorksOrderLabelKey, WorksOrderLabelResource, WorksOrderLabelResource> labelService, IWorksOrdersService worksOrdersService, IWorksOrderLabelPack worksOrderLabelPack) { this.worksOrdersService = worksOrdersService; this.worksOrderLabelPack = worksOrderLabelPack; this.labelService = labelService; this.outstandingWorksOrdersReportFacade = outstandingWorksOrdersReportFacade; this.Get("/production/works-orders", _ => this.GetWorksOrders()); this.Put("/production/works-orders/labels/{seq}/{part*}", _ => this.UpdateWorksOrderLabel()); this.Post("production/works-orders/labels", _ => this.AddWorksOrderLabel()); this.Get("/production/works-orders/labels", _ => this.GetWorksOrderLabelsForPart()); this.Get("/production/works-orders/batch-notes", _ => this.GetWorksOrderBatchNotes()); this.Get("/production/works-orders/labels/{seq}/{part*}", parameters => this.GetWorksOrderLabel(parameters.part, parameters.seq)); this.Get("/production/works-orders/{orderNumber}", parameters => this.GetWorksOrder(parameters.orderNumber)); this.Post("/production/works-orders", _ => this.AddWorksOrder()); this.Put("/production/works-orders/{orderNumber}", _ => this.UpdateWorksOrder()); this.Post("/production/works-orders/print-labels", _ => this.PrintWorksOrderLabels()); this.Post("/production/works-orders/print-aio-labels", _ => this.PrintWorksOrderAioLabels()); this.Get( "/production/works-orders/get-part-details/{partNumber*}", parameters => this.GetWorksOrderPartDetails(parameters.partNumber)); this.Get("/production/works-orders/outstanding-works-orders-report", _ => this.GetOutstandingWorksOrdersReport()); this.Get("/production/works-orders/outstanding-works-orders-report/export", _ => this.GetOutstandingWorksOrdersReportExport()); this.Get("/production/works-orders-for-part", _ => this.GetWorksOrdersForPart()); }
public void EstablishContext() { this.OutstandingWorksOrdersReportFacade = Substitute.For <IOutstandingWorksOrdersReportFacade>(); this.LabelService = Substitute .For <IFacadeService <WorksOrderLabel, WorksOrderLabelKey, WorksOrderLabelResource, WorksOrderLabelResource> >(); this.WorksOrdersService = Substitute.For <IWorksOrdersService>(); this.WorksOrderLabelPack = Substitute.For <IWorksOrderLabelPack>(); var bootstrapper = new ConfigurableBootstrapper( with => { with.Dependency(this.OutstandingWorksOrdersReportFacade); with.Dependency(this.WorksOrdersService); with.Dependency(this.LabelService); with.Dependency(this.WorksOrderLabelPack); with.Dependency <IResourceBuilder <ResultsModel> >(new ResultsModelResourceBuilder()); with.Dependency <IResourceBuilder <WorksOrder> >(new WorksOrderResourceBuilder()); with.Dependency <IResourceBuilder <IEnumerable <WorksOrder> > >( new WorksOrdersResourceBuilder()); with.Dependency <IResourceBuilder <IEnumerable <WorksOrder> > >(new WorksOrdersResourceBuilder()); with.Dependency <IResourceBuilder <WorksOrderPartDetails> >(new WorksOrderPartDetailsResourceBuilder()); with.Dependency <IResourceBuilder <WorksOrderLabel> >(new WorksOrderLabelResourceBuilder()); with.Dependency <IResourceBuilder <IEnumerable <WorksOrderLabel> > >(new WorksOrderLabelsResourceBuilder()); with.Dependency <IResourceBuilder <Error> >(new ErrorResourceBuilder()); with.Module <WorksOrdersModule>(); with.ResponseProcessor <ResultsModelJsonResponseProcessor>(); with.ResponseProcessor <IEnumerableCsvResponseProcessor>(); with.ResponseProcessor <WorksOrderResponseProcessor>(); with.ResponseProcessor <WorksOrdersResponseProcessor>(); with.ResponseProcessor <WorksOrderPartDetailsResponseProcessor>(); with.ResponseProcessor <WorksOrderLabelResponseProcessor>(); with.ResponseProcessor <WorksOrderLabelsResponseProcessor>(); with.ResponseProcessor <ErrorResponseProcessor>(); 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); }