public void ShouldValidateWorkerWithIncorrectSurnameToFalse(string surname)
        {
            var worker = new Worker()
            {
                ID = 0, Name = "ValidName", Surname = surname
            };

            Assert.That(WorkerValidator.Perform(worker), Is.False);
        }
        public void ShouldValidateWorkerWithCorrectDataToTrue()
        {
            var worker = new Worker()
            {
                ID = 0, Name = "ValidName", Surname = "ValidSurname"
            };

            Assert.That(WorkerValidator.Perform(worker), Is.True);
        }
Exemplo n.º 3
0
        private void SaveChanges()
        {
            if (WorkerValidator.Perform(EditedWorker))
            {
                switch (_selectedOperation)
                {
                case CrudOperation.Create:
                    _workersManager.AddWorker(EditedWorker);
                    break;

                case CrudOperation.Edit:
                    _workersManager.EditWorker(EditedWorker);
                    break;
                }
                IsWorkerEditVisible = false;
                RefreshWorkers();
            }
            else
            {
                MessageBox.Show("Yoe have entered incorrect data!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }