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

            var bootstrapper = new ConfigurableBootstrapper(
                with =>
            {
                with.Dependency(this.SalesAccountService);
                with.Dependency <IResourceBuilder <IEnumerable <SalesAccount> > >(new SalesAccountsResourceBuilder());
                with.Module <SalesAccountModule>();
                with.ResponseProcessor <SalesAccountsResponseProcessor>();
                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 SalesAccountUpdatedHandler(
     ISalesAccountService salesAccountService,
     ITransactionManager transactionManager,
     IRabbitTerminator rabbitTerminator)
 {
     this.salesAccountService = salesAccountService;
     this.transactionManager  = transactionManager;
     this.rabbitTerminator    = rabbitTerminator;
 }
コード例 #3
0
        public SalesAccountModule(ISalesAccountService salesAccountService)
        {
            this.salesAccountService = salesAccountService;

            this.Get("/sales/accounts", _ => this.GetSalesAccounts());
            this.Get("/sales/accounts/{id:int}", parameters => this.GetSalesAccount(parameters.id));
            this.Get("/sales/accounts/{id:int}/activities", parameters => this.GetSalesAccountActivities(parameters.id));
            this.Post("/sales/accounts", _ => this.AddSalesAccount());
            this.Put("/sales/accounts/{id:int}", parameters => this.UpdateSalesAccount(parameters.id));
            this.Delete("/sales/accounts/{id:int}", parameters => this.CloseSalesAccount(parameters.id));
        }
コード例 #4
0
ファイル: SalesAccountModule.cs プロジェクト: linn/stores
 public SalesAccountModule(ISalesAccountService salesAccountService)
 {
     this.salesAccountService = salesAccountService;
     this.Get("/inventory/sales-accounts", parameters => this.GetSalesAccounts());
 }