示例#1
0
        public async Task DeleteReportTest()
        {
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseInMemoryDatabase(Guid.NewGuid().ToString());
            var reportsRepository = new EfDeletableEntityRepository <Report>(new ApplicationDbContext(options.Options));

            foreach (var report in this.GetReportsData())
            {
                await reportsRepository.AddAsync(report);

                await reportsRepository.SaveChangesAsync();
            }

            var service = new ReportsService(reportsRepository);

            Assert.Equal(4, reportsRepository.All().Count());
            await service.DeleteReportAsync("1");

            Assert.Equal(3, reportsRepository.All().Count());
        }