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

            var bootstrapper = new ConfigurableBootstrapper(
                with =>
            {
                with.Dependency(this.TurnoverBandService);
                with.Dependency <IResourceBuilder <ProposedTurnoverBand> >(new ProposedTurnoverBandResourceBuilder());
                with.Dependency <IResourceBuilder <TurnoverBandProposal> >(new TurnoverBandProposalResourceBuilder());
                with.Module <TurnoverBandModule>();
                with.ResponseProcessor <ProposedTurnoverBandJsonResponseProcessor>();
                with.ResponseProcessor <TurnoverBandProposalJsonResponseProcessor>();
                with.ResponseProcessor <ProposedTurnoverBandsCsvResponseProcessor>();

                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 TurnoverBandModule(ITurnoverBandService turnoverBandService)
        {
            this.turnoverBandService = turnoverBandService;

            this.Get("/sales/accounts/turnover-band-proposals", _ => this.GetProposedTurnoverBands());
            this.Get("/sales/accounts/turnover-band-proposals/details/{id:int}", parameters => this.GetProposedTurnoverBand(parameters.id));
            this.Get("/sales/accounts/turnover-band-proposals/export", _ => this.ExportProposedTurnoverBands());
            this.Put("/sales/accounts/turnover-band-proposals/details/{id:int}", parameters => this.UpdateProposedTurnoverBand(parameters.id));
            this.Delete("/sales/accounts/turnover-band-proposals/details/{id:int}", parameters => this.ExcludeProposedTurnoverBand(parameters.id));
            this.Post("/sales/accounts/turnover-band-proposals", _ => this.SetProposedTurnoverBands());
            this.Post("/sales/accounts/turnover-band-proposals/apply", _ => this.AcceptProposedTurnoverBands());
        }