public StockLocatorsModule( IStockLocatorFacadeService service, IFacadeFilterService <StorageLocation, int, StorageLocationResource, StorageLocationResource, StorageLocationResource> storageLocationService, IFacadeService <InspectedState, string, InspectedStateResource, InspectedStateResource> inspectedStateService, IStockQuantitiesService stockQuantitiesService, IStockLocatorPricesService pricesService) { this.service = service; this.storageLocationService = storageLocationService; this.inspectedStateService = inspectedStateService; this.stockQuantitiesService = stockQuantitiesService; this.pricesService = pricesService; this.Get("/inventory/stock-locators", _ => this.GetStockLocators()); this.Get("/inventory/stock-locators/batches", _ => this.GetBatches()); this.Delete("/inventory/stock-locators/{id}", parameters => this.DeleteStockLocator(parameters.id)); this.Put("/inventory/stock-locators/{id}", parameters => this.UpdateStockLocator(parameters.id)); this.Get("/inventory/storage-locations", _ => this.GetStorageLocations()); this.Post("/inventory/stock-locators", _ => this.AddStockLocator()); this.Get("/inventory/stock-locators/states", _ => this.GetStates()); this.Get("/inventory/stock-locators-by-location/", _ => this.GetStockLocatorsByLocation()); this.Get("/inventory/stock-quantities/", _ => this.GetStockQuantities()); this.Get("/inventory/stock-locators/prices", _ => this.GetPrices()); }
public void EstablishContext() { this.StockLocatorFacadeService = Substitute .For <IStockLocatorFacadeService>(); this.QuantitiesService = Substitute.For <IStockQuantitiesService>(); this.StorageLocationService = Substitute .For <IFacadeFilterService <StorageLocation, int, StorageLocationResource, StorageLocationResource, StorageLocationResource> >(); this.StateService = Substitute .For <IFacadeService <InspectedState, string, InspectedStateResource, InspectedStateResource> >(); this.PricesService = Substitute.For <IStockLocatorPricesService>(); var bootstrapper = new ConfigurableBootstrapper( with => { with.Dependency(this.StockLocatorFacadeService); with.Dependency(this.StorageLocationService); with.Dependency(this.StateService); with.Dependency(this.QuantitiesService); with.Dependency(this.PricesService); with.Dependency <IResourceBuilder <StockQuantities> >(new StockQuantitiesResourceBuilder()); with.Dependency <IResourceBuilder <IEnumerable <StockQuantities> > >(new StockQuantitiesListResourceBuilder()); with.Dependency <IResourceBuilder <InspectedState> >(new InspectedStateResourceBuilder()); with.Dependency <IResourceBuilder <IEnumerable <InspectedState> > >(new InspectedStatesResourceBuilder()); with.Dependency <IResourceBuilder <StockLocator> >(new StockLocatorResourceBuilder()); with.Dependency <IResourceBuilder <IEnumerable <StockLocator> > >(new StockLocatorsResourceBuilder()); with.Dependency <IResourceBuilder <StorageLocation> >(new StorageLocationResourceBuilder()); with.Dependency <IResourceBuilder <IEnumerable <StorageLocation> > >(new StorageLocationsResourceBuilder()); with.Dependency <IResourceBuilder <StockLocatorWithStoragePlaceInfo> >( new StockLocatorResourceBuilder()); with.Dependency <IResourceBuilder <IEnumerable <StockLocatorWithStoragePlaceInfo> > >( new StockLocatorsWithStoragePlaceInfoResourceBuilder()); with.Dependency <IResourceBuilder <IEnumerable <StockLocatorPrices> > >( new StockLocatorPricesListResourceBuilder()); with.Module <StockLocatorsModule>(); with.ResponseProcessor <StockLocatorsResponseProcessor>(); with.ResponseProcessor <StockLocatorResponseProcessor>(); with.ResponseProcessor <StockLocatorsWithStoragePlaceInfoResponseProcessor>(); with.ResponseProcessor <StockQuantitiesListResponseProcessor>(); with.ResponseProcessor <StorageLocationsResponseProcessor>(); with.ResponseProcessor <InspectedStatesResponseProcessor>(); with.ResponseProcessor <StockLocatorPricesResponseProcessor>(); 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); }