コード例 #1
0
        public void EstablishContext()
        {
            this.ReportService = Substitute.For <ISernosUsedOnInvoiceReportService>();

            var bootstrapper = new ConfigurableBootstrapper(
                with =>
            {
                with.Dependency(this.ReportService);
                with.Dependency <IResourceBuilder <ResultsModel> >(new ResultsModelResourceBuilder());
                with.Dependency <ISernosUsedOnInvoiceFacade>(new SernosUsedOnInvoiceFacade(this.ReportService));
                with.Module <SernosUsedOnInvoiceModule>();
                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);
        }
コード例 #2
0
 public SernosUsedOnInvoiceFacade(ISernosUsedOnInvoiceReportService service)
 {
     this.service = service;
 }