Example #1
0
        public void EstablishContext()
        {
            this.SerialNumberReissueService = Substitute.For <ISerialNumberReissueService>();

            var bootstrapper = new ConfigurableBootstrapper(
                with =>
            {
                with.Dependency(this.SerialNumberReissueService);
                with.Dependency <IResourceBuilder <SerialNumberReissue> >(new SerialNumberReissueResourceBuilder());
                with.Module <SerialNumberReissueModule>();
                with.ResponseProcessor <SerialNumberReissueResponseProcessor>();
                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);
        }
Example #2
0
 public SerialNumberReissueModule(ISerialNumberReissueService serialNumberReissueService)
 {
     this.serialNumberReissueService = serialNumberReissueService;
     this.Post("/production/maintenance/serial-number-reissue", _ => this.AddSerialNumberReissue());
 }