コード例 #1
0
        public void EditEducationShoudEditOneOrMorePropertiesInEducation()
        {
            var options   = new DbContextOptionsBuilder <ApplicationDbContext>().UseInMemoryDatabase("Database_For_Tests").Options;
            var dbContext = new ApplicationDbContext(options);
            var service   = new EducationService(dbContext);

            var model = new UpdateDeleteEducationViewModel
            {
                Title = "Edited"
            };

            var education = new Education
            {
                Title = "New"
            };

            dbContext.Educations.Add(education);
            dbContext.SaveChanges();

            var educationToEdit = dbContext.Educations.First();

            service.EditEducation(educationToEdit, model);

            Assert.Equal("Edited", educationToEdit.Title);
        }