예제 #1
0
파일: WandModule.cs 프로젝트: linn/stores
        public WandModule(IWandFacadeService wandFacadeService, IConsignmentShipfileFacadeService shipfileService)
        {
            this.wandFacadeService = wandFacadeService;
            this.Get("/logistics/wand", _ => this.GetApp());
            this.Get("/logistics/wand/consignments", _ => this.GetConsignments());
            this.Get("/logistics/wand/items", _ => this.GetItems());
            this.Post("/logistics/wand/items", _ => this.WandItem());

            this.shipfileService = shipfileService;
            this.Get("/logistics/shipfiles", _ => this.GetShipfiles());
            this.Post("/logistics/shipfiles/send-emails", _ => this.SendEmails());
            this.Delete("/logistics/shipfiles/{id}", parameters => this.DeleteShipfile(parameters.id));
        }
예제 #2
0
파일: ContextBase.cs 프로젝트: linn/stores
        public void EstablishContext()
        {
            this.WandFacadeService = Substitute.For <IWandFacadeService>();
            this.ShipfileService   = Substitute.For <IConsignmentShipfileFacadeService>();
            var bootstrapper = new ConfigurableBootstrapper(
                with =>
            {
                with.Dependency(this.WandFacadeService);
                with.Dependency(this.ShipfileService);
                with.Dependency <IResourceBuilder <IEnumerable <WandConsignment> > >(new WandConsignmentsResourceBuilder());
                with.Dependency <IResourceBuilder <IEnumerable <WandItem> > >(new WandItemsResourceBuilder());
                with.Dependency <IResourceBuilder <WandResult> >(new WandItemResultResourceBuilder());
                with.Dependency <IResourceBuilder <ConsignmentShipfile> >(new ConsignmentShipfileResourceBuilder());
                with.Dependency <IResourceBuilder <IEnumerable <ConsignmentShipfile> > >(
                    new ConsignmentShipfilesResourceBuilder());
                with.Module <WandModule>();
                with.ResponseProcessor <WandConsignmentsResponseProcessor>();
                with.ResponseProcessor <WandItemsResponseProcessor>();
                with.ResponseProcessor <WandResultResponseProcessor>();
                with.ResponseProcessor <ConsignmentShipfileResponseProcessor>();
                with.ResponseProcessor <ConsignmentShipfilesResponseProcessor>();
                with.RequestStartup(
                    (container, pipelines, context) =>
                {
                    var claims = new List <Claim>
                    {
                        new Claim(ClaimTypes.Role, "employee"),
                        new Claim(ClaimTypes.NameIdentifier, "test-user"),
                        new Claim("privilege", "p1")
                    };

                    var user = new ClaimsIdentity(claims, "jwt");

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

            this.Browser = new Browser(bootstrapper);
        }