public void ChangeSuccessVisibility_WhenConfirmationSucceeded() { var mockedView = new Mock <IConfirmView>(); var mockedArgs = MockedEventArgsGenerator.GetConfirmEventArgs(); var userService = new Mock <IUserService>(); userService.Setup(s => s.ConfirmEmail(mockedArgs.UserId, mockedArgs.Code)) .Returns(IdentityResult.Success); var presenter = new ConfirmPresenter(userService.Object, mockedView.Object); mockedView.Raise(x => x.OnSubmit += null, mockedView.Object, mockedArgs); mockedView.VerifySet(v => v.SuccessPanelVisible = true, Times.Once); }
public void CallConfirmEmailMethod_WhenUserDataIsValid() { var mockedView = new Mock <IConfirmView>(); var mockedArgs = MockedEventArgsGenerator.GetConfirmEventArgs(); var userService = new Mock <IUserService>(); userService.Setup(s => s.ConfirmEmail(mockedArgs.UserId, mockedArgs.Code)) .Returns(IdentityResult.Failed(new string[1])); var presenter = new ConfirmPresenter(userService.Object, mockedView.Object); mockedView.Raise(x => x.OnSubmit += null, mockedView.Object, mockedArgs); userService.Verify(f => f.ConfirmEmail(mockedArgs.UserId, mockedArgs.Code), Times.Once()); }
public void ChangeMessagesVisibility_WhenUserIsNotConfirmed() { const string Email = "*****@*****.**"; var mockedView = new Mock <IConfirmView>(); var mockedArgs = MockedEventArgsGenerator.GetConfirmEventArgs(); var userService = new Mock <IUserService>(); userService.Setup(s => s.ConfirmEmail(mockedArgs.UserId, mockedArgs.Code)) .Returns(IdentityResult.Failed(Email)); var presenter = new ConfirmPresenter(userService.Object, mockedView.Object); mockedView.Raise(x => x.OnSubmit += null, mockedView.Object, mockedArgs); mockedView.VerifySet(v => v.SuccessPanelVisible = false, Times.Once); mockedView.VerifySet(v => v.ErrorPanelVisible = true, Times.Once); }