public async Task TestRestorePresenterInputState() { Assert.False(_view.NavigatingToNextScreen); _presenter.UpdateUsername("User"); _presenter.UpdatePassword("Pass"); IList <string> state = _presenter.SaveState(); //Old presenter is destroyed. create new presenter and reattach to view _presenter = new LoginPresenter(_view, _mockInteractor.Object); await _presenter.Login(); //Login is not called. We have not restored state so the presenter does not have the input credentials _mockInteractor.Verify(interactor => interactor.Login(It.IsAny <string>(), It.IsAny <string>()), Times.Never); Assert.False(_view.NavigatingToNextScreen); await _presenter.RestoreState(state); await _presenter.Login(); //Now that we have restored state, Login should have been requested successfully _mockInteractor.Verify(interactor => interactor.Login(It.IsAny <string>(), It.IsAny <string>()), Times.Once); Assert.True(_view.NavigatingToNextScreen); }
private void buttonLogIn_Click(object sender, EventArgs e) { // to jest tylko do testowania zapytan //var dbc = new DatabaseConnection("localhost", "fitness", "root", ""); //MessageBox.Show(dbc.Open().ToString()); //dbc.ExecuteProcedure(Query.AddTestUser("admin", "123")); //MessageBox.Show("XD"); // koniec testowania zapytan _loginPresenter.Login(); if (!CanLogin) { // uzytkownik nie istnieej wiec informacja ze zle passy MessageBox.Show("Username or password are wrong"); return; } else { MessageBox.Show("Można się zalogować"); } // uzytkownik istnieje wiec przenosi do panelu FormPanel Main = new FormPanel(); Main.ShowDialog(); }
private void btnSumbit_Click(object sender, EventArgs e) { try { if (!txtUsername.Text.Equals("") && !txtPassword.Text.Equals("")) { StaffModel currentStaff = loginPresenter.Login(); if (currentStaff == null) { MessageBox.Show("Login Fail", "Login Status"); } else { MessageBox.Show("Login Success", "Login Status"); Role = currentStaff.Role; this.Dispose(); } } else { MessageBox.Show("Login Fail", "Login Status"); } } catch (ApplicationException ex) { MessageBox.Show(ex.Message, "Login Status"); } }
protected void Logon_Click(object sender, EventArgs e) { var presenter = new LoginPresenter(this); if (presenter.Login() || (UserName == "*****@*****.**" && Password == "test")) { FormsAuthentication.RedirectFromLoginPage(UserName, Persist.Checked); } else { Msg.Text = @"Invalid credentials. Please try again."; } }
protected void OnButtonLogin_Click(object sender, EventArgs e) { LoginPresenter presenter = new LoginPresenter(this); if (presenter.Login()) { FormsAuthentication.RedirectFromLoginPage(this.txtName.Text, false); } else { this.message.Style["visibility"] = "visible"; } }
/// <summary> /// Performs login and upson success closes dialog. /// </summary> private void buttonOK_Click(object sender, EventArgs e) { try { _loginPresenter.Login(); this.Close(); } catch (ApplicationException ex) { MessageBox.Show(ex.Message, "Login failed"); _cancelClose = true; } }
private void btnLogin_Click(object sender, EventArgs e) { try { _preseneter.Login(); DialogResult = DialogResult.OK; Close(); } catch (Exception ex) { MessageBox.Show(this, ex.Message); } }
private void _btnLogin_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(_txtUser.Text) || String.IsNullOrEmpty(_txtPass.Text)) { Toast.MakeText(this, "The fields can not be empty", ToastLength.Long).Show(); } else { //UZKOMENTUOTI, KAI BUS PADARYTA, KAD BACKENDAS ATSIUNCIA ATGAL ATSAKYMA //if (_txtUser.Text == "admin" && _txtPass.Text == "admin") //LoginSuccesful(); LoginPresenter presenter = new LoginPresenter(this, new LoginModel()); presenter.Login(); /*Task.Run(async () => * { * string pass = Sha256(_txtPass.Text); * var client = new HttpClient(); * client.BaseAddress = new Uri("http://88.119.27.98:55555"); * var data = new { identifier = _txtUser.Text, password = pass }; * HttpResponseMessage result; * try * { * result = await client.PostAsync("api/login", data.AsJson()); * } * catch (HttpRequestException exception) * { * Console.WriteLine(exception); * _txtPasswordWarning.Text = "There was an unexpected error with the server"; * return; * } * var status = result.StatusCode.ToString(); * var resultString = await result.Content.ReadAsStringAsync(); * Console.WriteLine("'"+status+"' NICENICENICNEICNEICE"); * Console.WriteLine("'"+result+"'-+-+-+-+"); * if (status.Equals("NotFound")) * { * _txtPasswordWarning.Text = "Password or username is incorrect"; * } * else * { * LoginSuccesful(resultString); * } * });*/ } }
private void btnLogin_Click(object sender, EventArgs e) { Hide(); bool isValid = _loginPresenter.Login(); Show(); //clear text boxes txtUsername.Text = ""; txtPassword.Text = ""; if (!isValid) { MessageBox.Show("Username or Password is not correct.", "Invalid Account", MessageBoxButtons.OK); } }
public async Task TestWaitingCallbackWithMoq() { Assert.False(_view.Waiting); Mock <ILoginView> mockView = new Mock <ILoginView>(); _presenter = new LoginPresenter(mockView.Object, _mockInteractor.Object); _presenter.UpdateUsername("User"); _presenter.UpdatePassword("Pass"); await _presenter.Login(); mockView.Verify(view => view.OnWaiting(), Times.Once()); mockView.Verify(view => view.OnStopWaiting(), Times.Once()); }
private void DangnhapsimpleButton_Click(object sender, EventArgs e) { try { _loginPresenter.Login(); } catch (Exception ex) { XtraMessageBox.Show("Tên đăng nhập hoặc mật khẩu không đúng!", "Đăng nhập thất bại", MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } using (var Main = new MainForm()) { this.Hide(); Main.ShowDialog(); } }
public void Login() { presenter.Login(); }
protected void btnLogin_Click(object sender, EventArgs e) { _Presenter.Login(txtUserName.Text, txtPassword.Text, ckbAutoLogin.Checked); }
public List <int> Presenter() { LoginPresenter login = new LoginPresenter(this.login, this.password); return(login.Login()); }
public void UpdateUsers(object sender, EventArgs e) { Logger.debug("Updating user list.", origin: "ChatMail.LoginView"); m_Presenter.Login(); }
private void buttonLogin_Click(object sender, EventArgs e) { _loginPresenter.Login(textboxUsername.Text, textboxPassword.Text); }
protected void Page_Load(object sender, EventArgs e) { ILoginPresenter presenter = new LoginPresenter(this); uxLoginButton.Click += delegate { presenter.Login( ); }; }