public async Task Services_are_resolved_on_service_manifest() { // PaymentsService calls AccountsService internally. // In this test we mock AccountService so we know it is resolved and accessible from within PaymentsService. IEndPointConfiguration ep = EndPoints.First(x => x.ProviderName == CurrentDatabaseProviderName && x.API_Name == API_Name.BackOffice); await DropAndRecreate(ep); Mock <IAccountsService> fakeMSSQLAccountsService = new Mock <IAccountsService>(); fakeMSSQLAccountsService.Setup(x => x.GetAccountByID(It.IsAny <int>())).ReturnsAsync(new Account { Name = "TEST" }); using (var scope = Container.BeginLifetimeScope(builder => { builder.RegisterInstance(fakeMSSQLAccountsService.Object).Keyed <IAccountsService>(EndPointType.DBMS + CurrentDatabaseProviderName); })) { IAdaptiveClient <IBOServiceManifest> client = scope.Resolve <IAdaptiveClient <IBOServiceManifest> >(); Account account = await client.CallAsync(x => x.PaymentsService.GetAccountForPaymentID(1), ep.Name); Assert.AreEqual("TEST", account.Name); } }
public async Task <List <Product> > GetProducts() { return(await serviceClient.CallAsync(x => x.GetProducts())); }
public async Task <List <TimeCard> > GetTimeCards() { return(await serviceClient.CallAsync(x => x.GetTimeCards())); }
public async Task <List <Employee> > GetEmployees() { return(await serviceClient.CallAsync(x => x.GetEmployees())); }
public async Task <List <Order> > GetOrders() { return(await serviceClient.CallAsync(x => x.GetOrders())); }