Пример #1
0
        public void EstablishContext()
        {
            this.PartsFacadeService = Substitute.For <IPartsFacadeService>();

            this.PartRepository = Substitute.For <IRepository <Part, string> >();

            var bootstrapper = new ConfigurableBootstrapper(
                with =>
            {
                with.Dependency(this.PartsFacadeService);
                with.Dependency(this.PartRepository);
                with.Dependency <IResourceBuilder <Part> >(new PartResourceBuilder());
                with.Dependency <IResourceBuilder <IEnumerable <Part> > >(new PartsResourceBuilder());
                with.Module <PartsModule>();
                with.ResponseProcessor <PartResponseProcessor>();
                with.ResponseProcessor <PartsResponseProcessor>();
                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);
        }
Пример #2
0
 public PartsModule(IPartsFacadeService partsFacadeService)
 {
     this.partsFacadeService = partsFacadeService;
     this.Get("/production/maintenance/parts", _ => this.GetParts());
 }
Пример #3
0
        public PartsModule(
            IPartsFacadeService partsFacadeService,
            IUnitsOfMeasureService unitsOfMeasureService,
            IPartCategoryService partCategoryService,
            IProductAnalysisCodeService productAnalysisCodeService,
            IFacadeService <AssemblyTechnology, string, AssemblyTechnologyResource, AssemblyTechnologyResource> assemblyTechnologyService,
            IFacadeService <DecrementRule, string, DecrementRuleResource, DecrementRuleResource> decrementRuleService,
            IPartService partDomainService,
            IFacadeService <PartTemplate, string, PartTemplateResource, PartTemplateResource> partTemplateService,
            IPartLiveService partLiveService,
            IFacadeService <MechPartSource, int, MechPartSourceResource, MechPartSourceResource> mechPartSourceService,
            IFacadeService <Manufacturer, string, ManufacturerResource, ManufacturerResource> manufacturerService,
            IPartDataSheetValuesService dataSheetsValuesService,
            IAuthorisationService authService,
            IFacadeService <TqmsCategory, string, TqmsCategoryResource, TqmsCategoryResource> tqmsCategoriesService)
        {
            this.partsFacadeService = partsFacadeService;
            this.partDomainService  = partDomainService;
            this.authService        = authService;
            this.Get("/parts/create", _ => this.Negotiate.WithModel(ApplicationSettings.Get()).WithView("Index"));
            this.Get("/inventory/parts/sources/create", _ => this.Negotiate.WithModel(ApplicationSettings.Get()).WithView("Index"));
            this.Get("/parts/{id}", parameters => this.GetPart(parameters.id));
            this.Put("/parts/{id}", parameters => this.UpdatePart(parameters.id));
            this.Get("/parts", _ => this.GetParts());
            this.Post("/parts", _ => this.AddPart());
            this.Get("/parts/dept-stock-parts", _ => this.GetDeptStockParts());

            this.unitsOfMeasureService = unitsOfMeasureService;
            this.Get("inventory/units-of-measure", _ => this.GetUnitsOfMeasure());

            this.partCategoryService = partCategoryService;
            this.Get("inventory/part-categories", _ => this.GetPartCategories());

            this.partTemplateService = partTemplateService;
            this.Get("inventory/part-templates", _ => this.GetPartTemplates());

            this.productAnalysisCodeService = productAnalysisCodeService;
            this.Get("inventory/product-analysis-codes", _ => this.GetProductAnalysisCodes());
            this.Get("inventory/product-analysis-codes", _ => this.GetProductAnalysisCodes());

            this.assemblyTechnologyService = assemblyTechnologyService;
            this.Get("inventory/assembly-technologies", _ => this.GetAssemblyTechnologies());

            this.decrementRuleService = decrementRuleService;
            this.Get("inventory/decrement-rules", _ => this.GetDecrementRules());

            this.partLiveService = partLiveService;
            this.Get("inventory/parts/can-be-made-live/{id}", parameters => this.CheckCanBeMadeLive(parameters.id));

            this.mechPartSourceService = mechPartSourceService;
            this.Get("inventory/parts/sources/{id}", parameters => this.GetMechPartSource(parameters.id));
            this.Put("inventory/parts/sources/{id}", parameters => this.UpdateMechPartSource(parameters.id));
            this.Post("inventory/parts/sources", _ => this.AddMechPartSource());

            this.manufacturerService = manufacturerService;
            this.Get("/inventory/manufacturers", _ => this.GetManufacturers());

            this.dataSheetsValuesService = dataSheetsValuesService;
            this.Get("/inventory/parts/data-sheet-values", _ => this.GetPartDataSheetValues());

            this.tqmsCategoriesService = tqmsCategoriesService;
            this.Get("/inventory/parts/tqms-categories", _ => this.GetTqmsCategories());
        }