Example #1
0
        public ProductsModule(IProductsReportsService productsReportsService)
        {
            this.productsReportsService = productsReportsService;

            this.Get("/products/reports/product-ranges", _ => this.GetProductRanges());
            this.Get("/products/reports/sales-products-by-product-range", _ => this.GetSalesProductByRange());
        }
Example #2
0
        public void EstablishContext()
        {
            this.ProductsReportsService = Substitute.For <IProductsReportsService>();

            var bootstrapper = new ConfigurableBootstrapper(
                with =>
            {
                with.Dependency(this.ProductsReportsService);
                with.Dependency <IResourceBuilder <ResultsModel> >(new ResultsModelResourceBuilder());
                with.Module <ProductsModule>();
                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);
        }