public async Task Login_Returns_True_If_Succesfull() { instaApi.Setup(a => a.LoginAsync(true)).ReturnsAsync(Result.Success(InstaLoginResult.Success)); var result = await subject.LoginAsync(userName, password); Assert.Multiple(() => { instaApi.Verify(x => x.SetUser(userName, password)); Assert.IsTrue(result); }); }
private async void LoginButton_Click(object sender, RoutedEventArgs e) { LoginButton.IsEnabled = false; var isLoggedIn = await instaApi.LoginAsync(LoginText.Text, PasswordText.Password); if (isLoggedIn) { if (RememberMe.IsChecked.Value) { SaveSession(); } await GetUserData(); HideLoginItems(); } else { var dialogBox = new DialogBox($"Error during loging in"); dialogBox.Show(); } LoginButton.IsEnabled = true; }