public async Task AddSavesToDatabase()
        {
            var dbContextOptions = new DbContextOptionsBuilder <SupportWheelOfFateContext>()
                                   .UseInMemoryDatabase(databaseName: "TestInMemoryDatabase")
                                   .Options;

            using (var dbContext = new SupportWheelOfFateContext(dbContextOptions))
            {
                var repo = new EFScheduleRepository(dbContext);
                repo.Add(_testSchedule);
            }

            using (var dbContext = new SupportWheelOfFateContext(dbContextOptions))
            {
                Assert.Equal(1, await dbContext.Schedules.CountAsync());
                Assert.Equal(_testSchedule.Employee, (await dbContext.Schedules.SingleAsync()).Employee);
            }
        }
示例#2
0
 public EFScheduleRepository(SupportWheelOfFateContext dbContext)
 {
     _dbContext = dbContext;
 }