예제 #1
0
        private void GetEmployeeAndLoadNextView()
        {
            var employee = GetEmployeeForLoggedUser();

            if (employee == null)
            {   var hasher = new Sha256StringHasher();
                var employeeForNewUser = new Employee {Login = hasher.Hash(UserName)};
                ChangeUtility(new CreateEmployeeViewModel(employeeForNewUser, _employeeRepository, MainViewModel));
            }
            else
            {
                LoadViewModel(new HolidayCalendarViewModel(employee, _employeeRepository));
                Close();
            }
        }
예제 #2
0
        private Employee GetEmployeeForLoggedUser()
        {
            var hasher = new Sha256StringHasher();
            var existingUser = _employeeRepository.Find(hasher.Hash(UserName));

            return existingUser;
        }
예제 #3
0
        public void SuccessfullAuthenticationEmployeeFoundLoadsCalendarViewModel()
        {
            SettingsHelper.SaveConnectionString("Data Source=YOGER-SUPERMAN\\SQLEXPRESS;Initial Catalog=HolidayCalendar;Integrated Security=True;Connect Timeout=5");
            var hashedUserNameForExistingEmployee = new Sha256StringHasher().Hash(_userName);
            _mainViewModel.LoadUtilityViewModel(_viewModel);
            _employees.Add(new Employee {Login = hashedUserNameForExistingEmployee, FamilyName = "Bar"});

            _viewModel.UserName = _userName;
            _viewModel.Domain = _domain;
            _viewModel.LoginCommand.Execute(_passwordBox);

            Assert.IsInstanceOfType(_mainViewModel.CurrentViewModel, typeof(HolidayCalendarViewModel));
        }