Beispiel #1
0
        public void EstablishContext()
        {
            this.BtwResultFacadeService = Substitute.For <IBtwResultFacadeService>();

            var bootstrapper = new ConfigurableBootstrapper(
                with =>
            {
                with.Dependency(this.BtwResultFacadeService);
                with.Dependency <IResourceBuilder <ResultsModel> >(new ResultsModelResourceBuilder());
                with.Dependency <IResourceBuilder <IEnumerable <ResultsModel> > >(
                    new ResultsModelsResourceBuilder());
                with.Module <BuiltThisWeekModule>();

                with.ResponseProcessor <ResultsModelsJsonResponseProcessor>();
                with.ResponseProcessor <ResultsModelJsonResponseProcessor>();
                with.ResponseProcessor <IEnumerableCsvResponseProcessor>();

                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);
        }
Beispiel #2
0
 public BuiltThisWeekModule(IBtwResultFacadeService btwResultFacadeService)
 {
     this.btwResultFacadeService = btwResultFacadeService;
     this.Get("/production/reports/btw", _ => this.GetBtwResult());
 }