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

            var bootstrapper = new ConfigurableBootstrapper(
                with =>
            {
                with.Dependency(this.WeeeReportsService);
                with.Dependency <IResourceBuilder <ResultsModel> >(new ResultsModelResourceBuilder());
                with.Dependency <IResourceBuilder <IEnumerable <ResultsModel> > >(new ResultsModelsResourceBuilder());
                with.Module <WEEEReportModule>();
                with.ResponseProcessor <ResultsModelJsonResponseProcessor>();
                with.ResponseProcessor <ResultsModelsJsonResponseProcessor>();

                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);
        }
Esempio n. 2
0
 public WEEEReportModule(IWEEEReportsService weeeReportsService)
 {
     this.weeeReportsService = weeeReportsService;
     this.Get("/products/reports/weee", _ => this.GetWEEEReportOptions());
     this.Get("/products/reports/weee/report", _ => this.GetWEEEReport());
 }