Esempio n. 1
0
        public async Task TestDeleteReservationIsInDatabase()
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase(Guid.NewGuid().ToString());

            var reservationRepository = new EfDeletableEntityRepository <Reservation>(new ApplicationDbContext(options.Options));
            var reservationId         = Guid.NewGuid().ToString();

            await reservationRepository.AddAsync(new Reservation()
            {
                Id = reservationId
            });

            await reservationRepository.SaveChangesAsync();

            var reservationsService = new ReservationsService(reservationRepository);

            await reservationsService.DeleteAsync(reservationId, Guid.NewGuid().ToString());

            Assert.Equal(1, reservationRepository.AllWithDeleted().Count());
        }