public async Task AllConsumablePaymentsAsync_ShouldReturn_AllRentsThatAreNotPaid_IfSuchExist() { var db = GetDatabase(); var mapper = GetMapper(); var firstPayment = new Payment { Id = 1, PaidOn = new DateTime(2018, 12, 12), Amount = 10, MonthlyPaymentConsumableId = 1, CashPayment = false }; var secndPayment = new Payment { Id = 2, PaidOn = new DateTime(2017, 11, 6), Amount = 20, MonthlyPaymentConsumableId = 2, CashPayment = true }; var thirdPayment = new Payment { Id = 3, PaidOn = new DateTime(2016, 11, 12), Amount = 30, MonthlyPaymentConsumableId = 1, CashPayment = false }; var forthPayment = new Payment { Id = 4, PaidOn = new DateTime(2015, 12, 15), Amount = 40, MonthlyPaymentConsumableId = 3, CashPayment = false }; var fifthPayment = new Payment { Id = 5, PaidOn = new DateTime(2019, 12, 15), Amount = 50, MonthlyPaymentConsumableId = null, CashPayment = false }; await db.Payments.AddRangeAsync(firstPayment, secndPayment, thirdPayment, forthPayment, fifthPayment); await db.SaveChangesAsync(); var paymentService = new PaymentsService(mapper, db, null); //Act var result = await paymentService.AllConsumablePaymentsAsync(); //Assert result .Should() .BeOfType <List <PaymentConsumablesListingModel> >() .And .HaveCount(4) .And .Match(x => x.ElementAt(0).Amount == 10 && x.ElementAt(1).Amount == 20 && x.ElementAt(2).CashPayment == false); }