public async Task <List <DebitResponseModel> > GetCompanyDebits(int companyId) { if (companyId <= 0) { AddError("The company id is Invalid"); } var debits = await _debitRepository.GetCompanyDebits(companyId); return(debits.Select(x => DebitMap.DebitToDebitResponse(x)).ToList()); }
public async Task GetCompanyDebits() { var date = DateTime.UtcNow; var debitsOfCompanyModels = new List <DebitResponseModel>(); var debitsOfCompany = new List <Debit>(); var debitOfCompany1 = new Debit(1); var debitResponseOfCompany1 = DebitMap.DebitToDebitResponse(debitOfCompany1); for (int i = 0; i < 5; i++) { debitsOfCompanyModels.Add(debitResponseOfCompany1); debitsOfCompany.Add(debitOfCompany1); } _debitRepository.GetCompanyDebits(1).Returns(debitsOfCompany); var response = await _debitService.GetCompanyDebits(1); response.Should().BeEquivalentTo(debitsOfCompanyModels); }