public void TestInitialize() { if (Membership.CurrentUser == null) { UserRepository repository = new UserRepository(); User user = new User(); user = repository.TryGetCurrentUser(); if (user == null) { user = new User(); user.Name = LoginViewModelTest.LOGIN; user.Password = LoginViewModelTest.PASSWORD; Server server = new Server(); server.Address = LoginViewModelTest.SERVER_PATH; user.ID = 0; user.Server = server; user.IsCurrent = true; repository.AddNewUser(user); } Membership.CheckUserData(user.Name, user.Password, user.Server.Address, this.OnUserAuthenticated); } }
private static void CheckUserDataCallback(AuthentificationCode result) { if (result == AuthentificationCode.LoginSuccessed) { using (var userRepository = new UserRepository()) _authUser = userRepository.AddNewUser(_authUser); SetCurrentUser(_authUser); } InvokeCallbackWithAuthCodeParameter(result); }