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(); } }
private Employee GetEmployeeForLoggedUser() { var hasher = new Sha256StringHasher(); var existingUser = _employeeRepository.Find(hasher.Hash(UserName)); return existingUser; }
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)); }