Пример #1
0
        public StoragePlaceModule(
            IStoragePlaceAuditReportFacadeService reportService,
            IAuditLocationService auditLocationService,
            IStoragePlaceService storagePlaceService)
        {
            this.reportService        = reportService;
            this.auditLocationService = auditLocationService;
            this.storagePlaceService  = storagePlaceService;
            this.Get("/inventory/reports/storage-place-audit/report", _ => this.StoragePlaceAuditReport());
            this.Get("/inventory/reports/storage-place-audit", _ => this.StoragePlaceAuditReportOptions());
            this.Get("/inventory/audit-locations", _ => this.GetAuditLocations());
            this.Get("/inventory/storage-places", _ => this.GetStoragePlaces());
            this.Get("/inventory/storage-place", _ => this.GetStoragePlace());

            this.Post("/inventory/storage-places/create-audit-reqs", _ => this.CreateAuditReqs());
        }
Пример #2
0
        public void EstablishContext()
        {
            this.StoragePlaceAuditReportFacadeService = Substitute.For <IStoragePlaceAuditReportFacadeService>();
            this.AuditLocationService = Substitute.For <IAuditLocationService>();
            this.StoragePlaceService  = Substitute.For <IStoragePlaceService>();

            var bootstrapper = new ConfigurableBootstrapper(
                with =>
            {
                with.Dependency(this.StoragePlaceAuditReportFacadeService);
                with.Dependency(this.AuditLocationService);
                with.Dependency(this.StoragePlaceService);
                with.Dependency <IResourceBuilder <ResultsModel> >(new ResultsModelResourceBuilder());
                with.Dependency <IResourceBuilder <IEnumerable <AuditLocation> > >(
                    new AuditLocationsResourceBuilder());
                with.Dependency <IResourceBuilder <StoragePlace> >(
                    new StoragePlaceResourceBuilder());
                with.Dependency <IResourceBuilder <IEnumerable <StoragePlace> > >(
                    new StoragePlacesResourceBuilder());
                with.Dependency <IResourceBuilder <Error> >(new ErrorResourceBuilder());
                with.ResponseProcessor <AuditLocationsResponseProcessor>();
                with.ResponseProcessor <StoragePlacesResponseProcessor>();
                with.ResponseProcessor <StoragePlaceResponseProcessor>();
                with.ResponseProcessor <ResultsModelJsonResponseProcessor>();
                with.ResponseProcessor <ErrorResponseProcessor>();
                with.Module <StoragePlaceModule>();
                with.RequestStartup(
                    (container, pipelines, context) =>
                {
                    var claims = new List <Claim>
                    {
                        new Claim(ClaimTypes.Role, "employee"),
                        new Claim(ClaimTypes.NameIdentifier, "test-user"),
                        new Claim("employee", "/e/33607")
                    };
                    var user = new ClaimsIdentity(claims, "jwt");

                    context.CurrentUser = new ClaimsPrincipal(user);
                });
            });

            this.Browser = new Browser(bootstrapper);
        }
Пример #3
0
 public StoragePlacesModule(IStoragePlaceService storagePlaceService)
 {
     this.storagePlaceService = storagePlaceService;
     this.Get("production/maintenance/storage-places", _ => this.GetStoragePlaces());
 }