Esempio n. 1
0
        public void EstablishContext()
        {
            this.Service = Substitute.For <IProductsOnHoldReportService>();

            var bootstrapper = new ConfigurableBootstrapper(
                with =>
            {
                with.Dependency(this.Service);
                with.Dependency <IResourceBuilder <ResultsModel> >(new ResultsModelResourceBuilder());
                with.Module <ProductsOnHoldReportModule>();
                with.ResponseProcessor <ResultsModelJsonResponseProcessor>();
                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);
        }
 public ProductsOnHoldReportModule(IProductsOnHoldReportService productsOnHoldService)
 {
     this.productsOnHoldService = productsOnHoldService;
     this.Get("/products/reports/products-on-hold/", parameters => this.GetProductsOnHold());
 }