public RetailerDemListModule(IDemStockService demStockService) { this.demStockService = demStockService; this.Get("/retailers/{retailerId:int}/dem-stock", parameters => this.GetRetailerDemListById(parameters.retailerId)); this.Get("/retailers/{retailerId:int}/dem-stock/activities", parameters => this.GetRetailerDemListActivitiesById(parameters.retailerId)); this.Put("/retailers/{retailerId:int}/dem-stock/products", parameters => this.SetRootProductQuantity(parameters.retailerId)); this.Put("/retailers/{retailerId:int}/dem-stock", parameters => this.SetLastReviewedDate(parameters.retailerId)); this.Get("/retailers/dem-stock/last-reviewed", _ => this.GetRetailerDemListsByLastReviewed()); this.Get("/retailers/dem-stock/last-reviewed/export", _ => this.GetRetailerDemListsByLastReviewedExport()); this.Get("/retailers/dem-stock/lists-without-product", _ => this.GetRetailerDemListsExcludingProduct()); this.Get("/retailers/dem-stock/lists-without-product/export", _ => this.GetRetailerDemListsExcludingProductExport()); this.Get("/retailers/dem-stock/root-products/export", _ => this.GetAllRootProductsOnDemExport()); }
public void EstablishContext() { this.DemStockService = Substitute.For <IDemStockService>(); var bootstrapper = new ConfigurableBootstrapper( with => { with.Dependency(this.DemStockService); with.Dependency <IResourceBuilder <RetailerDemList> >(new RetailerDemListResourceBuilder()); with.Dependency <IResourceBuilder <IEnumerable <RetailerDemList> > >(new RetailerDemListsResourceBuilder()); with.Dependency <IResourceBuilder <RootProduct> >(new RootProductResourceBuilder()); with.Dependency <IResourceBuilder <IEnumerable <RetailerDemListActivity> > >(new RetailerDemListActivitiesResourceBuilder()); with.Module <RetailerDemListModule>(); with.ResponseProcessor <RetailerDemListJsonResponseProcessor>(); with.ResponseProcessor <RetailerDemListsJsonResponseProcessor>(); with.ResponseProcessor <RootProductJsonResponseProcessor>(); with.ResponseProcessor <RetailerDemListActivitiesJsonResponseProcessor>(); with.ResponseProcessor <RetailerDemListsCsvResponseProcessor>(); with.ResponseProcessor <RootProductsOnDemCsvResponseProcessor>(); 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); }