Exemplo n.º 1
0
 public WhoBuiltWhatReportModule(IWhoBuiltWhatReportFacadeService reportService)
 {
     this.reportService = reportService;
     this.Get("/production/reports/who-built-what/report", _ => this.WhoBuiltWhat());
     this.Get("/production/reports/who-built-what", _ => this.WhoBuiltWhatOptions());
     this.Get("/production/reports/who-built-what-details", _ => this.WhoBuiltWhatDetails());
 }
Exemplo n.º 2
0
        public void EstablishContext()
        {
            this.WhoBuiltWhatReportFacadeService = Substitute.For <IWhoBuiltWhatReportFacadeService>();

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