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); }
public SalesAccountUpdatedHandler( ISalesAccountService salesAccountService, ITransactionManager transactionManager, IRabbitTerminator rabbitTerminator) { this.salesAccountService = salesAccountService; this.transactionManager = transactionManager; this.rabbitTerminator = rabbitTerminator; }
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)); }
public SalesAccountModule(ISalesAccountService salesAccountService) { this.salesAccountService = salesAccountService; this.Get("/inventory/sales-accounts", parameters => this.GetSalesAccounts()); }