public void CancelCommandNavigatesToLoginScreen()
        {
            _viewModel = new CreateEmployeeViewModel(new Employee(), _repository, _mainViewModel);
            _mainViewModel.LoadUtilityViewModel(_viewModel);

            _viewModel.CancelCommand.Execute(null);

            Assert.IsInstanceOfType(_mainViewModel.CurrentUtilityViewModel, typeof(LoginViewModel));
        }
        public void SaveCannotBeExecutedIfAnyNameInViewModelIsNullOrEmpty()
        {
            var employeeToSave = new Employee();
            _viewModel = new CreateEmployeeViewModel(employeeToSave, _repository, _mainViewModel)
            {
                FirstName = null,
                FamilyName = "Smith"
            };
            var canSave = _viewModel.SaveEmployeeCommand.CanExecute(null);

            Assert.IsFalse(canSave);
        }
        public void SaveCommandNavigatesToCalendarIfSuccessfullySaved()
        {
            _employees.Clear();
            _viewModel = new CreateEmployeeViewModel(new Employee (), _repository, _mainViewModel)
            {
                FirstName = "Adam",
                FamilyName = "West"

            };
            _mainViewModel.LoadUtilityViewModel(_viewModel);

            _viewModel.SaveEmployeeCommand.Execute(null);

            Assert.IsInstanceOfType(_mainViewModel.CurrentViewModel, typeof(HolidayCalendarViewModel));
        }
        public void SavingNewEmployeeIsPersistedInRepository()
        {
            var employeeToSave = new Employee {FamilyName = "Smith", FirstName = "John"};
            _viewModel = new CreateEmployeeViewModel(employeeToSave, _repository, _mainViewModel);
            _viewModel.SaveEmployeeCommand.Execute(null);

            CollectionAssert.Contains(_employees, employeeToSave);
        }
        public void SavedEmployeeHasPropertiesFromViewModel()
        {
            _employees.Clear();
            var employeeToSave = new Employee ();
            _viewModel = new CreateEmployeeViewModel(employeeToSave, _repository, _mainViewModel)
            {
                FirstName = "John",
                FamilyName = "Smith"
            };
            _viewModel.SaveEmployeeCommand.Execute(null);

            Assert.AreEqual(_viewModel.FirstName, _employees.First().FirstName);
            Assert.AreEqual(_viewModel.FamilyName, _employees.First().FamilyName);
        }