public void RemoveAsync_ReturnsTrue() { 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), }; var reservationsService = new ReservationsService(dbContext); dbContext.Reservations.Add(reservation); dbContext.SaveChanges(); var result = reservationsService.RemoveAsync(reservation.Id); Assert.True(result.Result); } }
public void RemoveAsync_ReturnsFalse() { var options = new DbContextOptionsBuilder <ApplicationDbContext>().UseInMemoryDatabase(Guid.NewGuid().ToString()).Options; using (var dbContext = new ApplicationDbContext(options)) { var reservationsService = new ReservationsService(dbContext); var result = reservationsService.RemoveAsync("ffsaf"); Assert.False(result.Result); } }