public async Task TestGetRecipientMoneyFlowTypes_CheckProperties() { var moneyFlowSourceRecipientType = new MoneyFlowSourceRecipientType { MoneyFlowSourceRecipientTypeId = 1, TypeName = "type" }; var peerMoneyFlowSourceRecipientType = new MoneyFlowSourceRecipientType { MoneyFlowSourceRecipientTypeId = 2, TypeName = "peer type" }; var setting = new MoneyFlowSourceRecipientTypeSetting { Id = 1, IsRecipient = true, MoneyFlowSourceRecipientType = moneyFlowSourceRecipientType, MoneyFlowSourceRecipientTypeId = moneyFlowSourceRecipientType.MoneyFlowSourceRecipientTypeId, PeerMoneyFlowSourceRecipientType = peerMoneyFlowSourceRecipientType, PeerMoneyFlowSourceRecipientTypeId = peerMoneyFlowSourceRecipientType.MoneyFlowSourceRecipientTypeId }; moneyFlowSourceRecipientType.MoneyFlowSourceRecipientTypeSettings.Add(setting); context.MoneyFlowSourceRecipientTypes.Add(moneyFlowSourceRecipientType); context.MoneyFlowSourceRecipientTypes.Add(peerMoneyFlowSourceRecipientType); context.MoneyFlowSourceRecipientTypeSettings.Add(setting); Action <List <MoneyFlowSourceRecipientTypeDTO> > tester = (results) => { Assert.AreEqual(1, results.Count); var firstResult = results.First(); Assert.AreEqual(peerMoneyFlowSourceRecipientType.MoneyFlowSourceRecipientTypeId, firstResult.Id); Assert.AreEqual(peerMoneyFlowSourceRecipientType.TypeName, firstResult.Name); }; var serviceResults = service.GetRecipientMoneyFlowTypes(moneyFlowSourceRecipientType.MoneyFlowSourceRecipientTypeId); var serviceResultsAsync = await service.GetRecipientMoneyFlowTypesAsync(moneyFlowSourceRecipientType.MoneyFlowSourceRecipientTypeId); tester(serviceResults); tester(serviceResultsAsync); }
public async Task TestGetSourceMoneyFlowTypes_NoSources() { var moneyFlowSourceRecipientType = new MoneyFlowSourceRecipientType { MoneyFlowSourceRecipientTypeId = 1, TypeName = "type" }; var peerMoneyFlowSourceRecipientType = new MoneyFlowSourceRecipientType { MoneyFlowSourceRecipientTypeId = 2, TypeName = "peer type" }; var setting = new MoneyFlowSourceRecipientTypeSetting { Id = 1, IsSource = false, MoneyFlowSourceRecipientType = moneyFlowSourceRecipientType, MoneyFlowSourceRecipientTypeId = moneyFlowSourceRecipientType.MoneyFlowSourceRecipientTypeId, PeerMoneyFlowSourceRecipientType = peerMoneyFlowSourceRecipientType, PeerMoneyFlowSourceRecipientTypeId = peerMoneyFlowSourceRecipientType.MoneyFlowSourceRecipientTypeId }; moneyFlowSourceRecipientType.MoneyFlowSourceRecipientTypeSettings.Add(setting); context.MoneyFlowSourceRecipientTypes.Add(moneyFlowSourceRecipientType); context.MoneyFlowSourceRecipientTypes.Add(peerMoneyFlowSourceRecipientType); context.MoneyFlowSourceRecipientTypeSettings.Add(setting); Action <List <MoneyFlowSourceRecipientTypeDTO> > tester = (results) => { Assert.AreEqual(0, results.Count); }; var serviceResults = service.GetSourceMoneyFlowTypes(moneyFlowSourceRecipientType.MoneyFlowSourceRecipientTypeId); var serviceResultsAsync = await service.GetSourceMoneyFlowTypesAsync(moneyFlowSourceRecipientType.MoneyFlowSourceRecipientTypeId); tester(serviceResults); tester(serviceResultsAsync); }