public async Task ShouldNavigateToSetPINPageWhenEnteredValidConfirmationCode() { viewService .Setup(m => m.SetCurrentPage(It.Is((BaseViewModel p) => p.GetType() == typeof(SetPinViewModel)))) .Verifiable(); SetPinViewModel CreateSetPinView() => new SetPinViewModel(null, null, null, null, null); var viewModel = new ConfirmationCodeEntryViewModel(1, CreateSetPinView, accountService.Object, viewService.Object, dataFlow.Object, deviceInfo.Object, connectivity.Object); viewModel.View = view.Object; viewModel.ConfirmationCode.Value = ValidCode; await viewModel.Confirm(); viewService.Verify(); }
public async Task ShouldShowErrorMessageWhenEnteredInvalidConfirmationCode() { view .Setup(m => m.DisplayAlert("Invalid Code", "Invalid confirmation code", "Ok")) .Returns(Task.CompletedTask) .Verifiable("Expected to show an error message when confirmation code is invalid"); var viewModel = new ConfirmationCodeEntryViewModel(1, null, accountService.Object, viewService.Object, dataFlow.Object, deviceInfo.Object, connectivity.Object); viewModel.View = view.Object; viewModel.ConfirmationCode.Value = "an invalid confirmation code"; await viewModel.Confirm(); view.Verify(); dataFlow.VerifyNoOtherCalls(); viewService.VerifyNoOtherCalls(); }