public async Task AllAsync_SouldReturn_CollectionWithActualRentAgreements_FromDb() { var db = this.GetDatabase(); var mapper = this.GetMapper(); var firstRent = new RentAgreement { Id = 1, MonthlyPrice = 800, IsActual = false, Client = new Client { Id = 1, Name = "Asen" } }; var secondRent = new RentAgreement { Id = 2, MonthlyPrice = 900, IsActual = true, Client = new Client { Id = 2, Name = "Boris" } }; var thirdRent = new RentAgreement { Id = 3, MonthlyPrice = 1900, IsActual = true, Client = new Client { Id = 3, Name = "Ceco" } }; var forthRent = new RentAgreement { Id = 4, MonthlyPrice = 2900, IsActual = true, Client = new Client { Id = 4, Name = "Asen" } }; await db.RentAgreements.AddRangeAsync(firstRent, secondRent, thirdRent, forthRent); await db.SaveChangesAsync(); var rentService = new RentsService(mapper, db, null); var result = await rentService.AllAsync(); result .Should() .NotBeEmpty() .And .BeOfType <List <RentListingViewModel> >() .And .HaveCount(3) .And .Match(c => c.ElementAt(0).Id == 4 && c.ElementAt(1).Id == 2); }