Beispiel #1
0
        public void TestMethodUpdate()
        {
            OptionInstance.ConfigAutomapper();

            EmployeeRepo repo = new EmployeeRepo(@"Persist Security Info=False;Integrated Security=true;Initial Catalog=RJD.Test;Server=localhost");

            // TODO: при указании миллисекунд, тест падает
            DateTime dateTime = new DateTime(2019, 8, 12, 20, 22, 59);

            var createDto = new EmployeeDto
            {
                Id      = Guid.NewGuid(),
                Name    = "Иван",
                Surname = "Иванов"
            };

            repo.Create(createDto);

            createDto.BornDate = dateTime;

            repo.Update(createDto);

            var readDto = repo.Read(createDto.Id);

            Assert.AreEqual(readDto, createDto);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            OptionInstance.ConfigAutomapper();

            EmployeeRepo repo = new EmployeeRepo(@"Persist Security Info=False;Integrated Security=true;Initial Catalog=RJD;Server=localhost");

            var createDto = new EmployeeDto
            {
                Id      = Guid.NewGuid(),
                Name    = "Иван",
                Surname = "Иванов"
            };

            repo.Create(createDto);
        }
Beispiel #3
0
        public void TestMethodCreate()
        {
            OptionInstance.ConfigAutomapper();

            EmployeeRepo repo = new EmployeeRepo(@"Persist Security Info=False;Integrated Security=true;Initial Catalog=RJD.Test;Server=localhost");

            var createDto = new EmployeeDto
            {
                Id      = Guid.NewGuid(),
                Name    = "Иван",
                Surname = "Иванов"
            };

            repo.Create(createDto);

            var readDto = repo.Read(createDto.Id);

            Assert.AreEqual(readDto, createDto);
        }
Beispiel #4
0
        public void TestMethodDelete()
        {
            OptionInstance.ConfigAutomapper();

            EmployeeRepo repo = new EmployeeRepo(@"Persist Security Info=False;Integrated Security=true;Initial Catalog=RJD.Test;Server=localhost");

            var createDto = new EmployeeDto
            {
                Id       = Guid.NewGuid(),
                Name     = "Иван",
                Surname  = "Иванов",
                BornDate = new DateTime(2019, 8, 12, 20, 22, 59)
            };

            repo.Create(createDto);

            bool isCreated = !repo.Read(createDto.Id).IsNull();

            repo.Delete(createDto);

            var readDto = repo.Read(createDto.Id);

            Assert.IsTrue(isCreated && readDto.IsNull());
        }
Beispiel #5
0
 protected override void OnStartup(StartupEventArgs e)
 {
     OptionInstance.ConfigAutomapper();
     base.OnStartup(e);
 }