示例#1
0
        public void AddEmploye_GoodData_ReturnOk()
        {
            DbContextOptions <ApplicationContext> options = new DbContextOptionsBuilder <ApplicationContext>()
                                                            .UseInMemoryDatabase(Guid.NewGuid().ToString())
                                                            .EnableSensitiveDataLogging()
                                                            .Options;
            var dbProvider = new DatabaseProvider(options);

            dbProvider.EnsureDeleted();

            Employe employe1 = new Employe {
                FirstName = "Anton", MiddleName = "Antonovich", LastName = "Antonov"
            };

            dbProvider.AddEmploye(employe1);

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