コード例 #1
0
        public async Task AddInstructorLab_PersistsInstructorLab()
        {
            var lab = new InstructorLab
            {
                Title        = "Lab 1",
                InstructorId = 1
            };

            using (var context = new ApplicationDbContext(Options))
            {
                var service = new InstructorLabService(context);

                InstructorLab addedInstructorLab = await service.AddLab(lab);

                Assert.AreEqual(addedInstructorLab, lab);
                Assert.AreNotEqual(0, addedInstructorLab.Id);
            }

            using (var context = new ApplicationDbContext(Options))
            {
                InstructorLab retrievedInstructorLab = context.InstructorLabs.Single();
                Assert.AreEqual(lab.Title, retrievedInstructorLab.Title);
            }
        }