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

            var bootstrapper = new ConfigurableBootstrapper(
                with =>
            {
                with.Dependency(this.ShortageSummaryFacadeService);
                with.Dependency <IResourceBuilder <ShortageSummary> >(new ShortageSummaryResourceBuilder());
                with.Module <ShortageModule>();
                with.ResponseProcessor <ShortageSummaryJsonResponseProcessor>();
                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 ShortageModule(IShortageSummaryFacadeService shortageSummaryFacadeService)
 {
     this.shortageSummaryFacadeService = shortageSummaryFacadeService;
     this.Get("/production/reports/shortages", _ => this.GetShortages());
 }