コード例 #1
0
ファイル: ContextBase.cs プロジェクト: linn/stores
        public void EstablishContext()
        {
            this.InterCompanyInvoiceService = Substitute.For <IInterCompanyInvoiceService>();

            var bootstrapper = new ConfigurableBootstrapper(
                with =>
            {
                with.Dependency(this.InterCompanyInvoiceService);
                with.Dependency <IResourceBuilder <IEnumerable <InterCompanyInvoice> > >(
                    new InterCompanyInvoicesResourceBuilder());
                with.Module <InterCompanyInvoiceModule>();
                with.ResponseProcessor <InterCompanyInvoicesResponseProcessor>();
                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 InterCompanyInvoiceModule(IInterCompanyInvoiceService interCompanyInvoiceService)
 {
     this.interCompanyInvoiceService = interCompanyInvoiceService;
     this.Get("/inventory/exports/inter-company-invoices", _ => this.GetInterCompanyInvoices());
 }