public void Count_ReturnsCorrectCount() { var options = new DbContextOptionsBuilder <ApplicationDbContext>().UseInMemoryDatabase(Guid.NewGuid().ToString()).Options; using (var dbContext = new ApplicationDbContext(options)) { Reservation reservation = new Reservation() { VehicleMake = "BMW", VehicleModel = "M5", LicenseNumber = "СА 1234 КР", PhoneNumber = "0897482124", ReservationDateTime = new DateTime(2020, 3, 21, 10, 30, 10), }; dbContext.Reservations.Add(reservation); dbContext.SaveChanges(); var reservationsService = new ReservationsService(dbContext); int reservationsCount = reservationsService.Count(); Assert.Equal(1, reservationsCount); } }