コード例 #1
0
        public void EditEmploye()
        {
            DbContextOptions <ApplicationContext> options = new DbContextOptionsBuilder <ApplicationContext>()
                                                            .UseInMemoryDatabase(Guid.NewGuid().ToString())
                                                            .EnableSensitiveDataLogging()
                                                            .Options;
            var     dbProvider = new DatabaseProvider(options);
            Employe employe1   = new Employe {
                FirstName = "Anton", MiddleName = "Antonovich", LastName = "Antonov"
            };

            dbProvider.AddEmploye(employe1);

            Employe employe2 = new Employe {
                FirstName = "Antonina", MiddleName = "Antonovna", LastName = "Antonova"
            };

            dbProvider.EditEmploye(employe2, employe1.Id);
            Assert.AreEqual(employe2.FirstName, (dbProvider.GetEmploye(employe1.Id)).FirstName);
            Assert.AreEqual(employe2.MiddleName, (dbProvider.GetEmploye(employe1.Id)).MiddleName);
            Assert.AreEqual(employe2.LastName, (dbProvider.GetEmploye(employe1.Id)).LastName);
        }