Esempio n. 1
0
        public void EstablishContext()
        {
            this.FacadeService = Substitute.For <IFacadeService <BoardFailType, int, BoardFailTypeResource, BoardFailTypeResource> >();
            this.BoardTestReportFacadeService = Substitute.For <IBoardTestReportFacadeService>();

            var bootstrapper = new ConfigurableBootstrapper(
                with =>
            {
                with.Dependency(this.FacadeService);
                with.Dependency(this.BoardTestReportFacadeService);
                with.Dependency <IResourceBuilder <BoardFailType> >(new BoardFailTypeResourceBuilder());
                with.Dependency <IResourceBuilder <ResultsModel> >(new ResultsModelResourceBuilder());
                with.Dependency <IResourceBuilder <IEnumerable <BoardFailType> > >(
                    new BoardFailTypesResourceBuilder());
                with.Module <BoardTestsModule>();
                with.ResponseProcessor <BoardFailTypeResponseProcessor>();
                with.ResponseProcessor <BoardFailTypesResponseProcessor>();
                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);
        }
Esempio n. 2
0
        public BoardTestsModule(
            IFacadeService <BoardFailType, int, BoardFailTypeResource, BoardFailTypeResource> facadeService,
            IBoardTestReportFacadeService boardTestReportFacadeService)
        {
            this.boardTestReportFacadeService = boardTestReportFacadeService;
            this.facadeService = facadeService;

            this.Get("/production/reports/board-tests-report", _ => this.GetBoardTestsReport());
            this.Get("/production/reports/board-test-details-report", _ => this.GetBoardTestDetailsReport());
            this.Get("/production/reports/board-tests-report/report", _ => this.GetApp());
            this.Get("/production/resources/board-fail-types", _ => this.GetAll());
            this.Get("/production/resources/board-fail-types/{type*}", parameters => this.GetById(parameters.type));
            this.Put("/production/resources/board-fail-types/{type*}", parameters => this.Update(parameters.type));
            this.Post("/production/resources/board-fail-types", parameters => this.Add());
        }