public void TestOnResetPasswordFailEmpty() { Mock <IAuth> authMock = new Mock <IAuth>(MockBehavior.Strict); authMock.Setup(a => a.SendPasswordResetEmailAsync(It.IsAny <string>())) .Returns(Task.FromResult(true)); Mock <INavigationService> navigationMock = new Mock <INavigationService>(MockBehavior.Strict); ForgotPasswordViewModel forgotPassVM = new ForgotPasswordViewModel(authMock.Object, navigationMock.Object); forgotPassVM.OnResetPassword(); Assert.IsTrue(forgotPassVM.ErrorVis); authMock.Verify(a => a.SendPasswordResetEmailAsync(It.IsAny <string>()), Times.Never); }
public void TestOnResetPasswordSucess() { Mock <IAuth> authMock = new Mock <IAuth>(MockBehavior.Strict); authMock.Setup(a => a.SendPasswordResetEmailAsync(It.IsAny <string>())) .Returns(Task.FromResult(true)); Mock <INavigationService> navigationMock = new Mock <INavigationService>(MockBehavior.Strict); navigationMock.Setup(a => a.NavigateToLogin()).Returns(Task.CompletedTask); ForgotPasswordViewModel forgotPassVM = new ForgotPasswordViewModel(authMock.Object, navigationMock.Object) { Email = "*****@*****.**" }; forgotPassVM.OnResetPassword(); Assert.IsFalse(forgotPassVM.ErrorVis); authMock.Verify(a => a.SendPasswordResetEmailAsync(It.IsAny <string>()), Times.Once); navigationMock.Verify(a => a.NavigateToLogin(), Times.Once); }