public async Task OnPostEmailMfaAsync_GivenCommandFails_ExpectPrgErrorStateAndRedirectToSamePage()
        {
            var mediator = new Mock <IMediator>();

            mediator.Setup(x => x.Send(It.IsAny <EmailMfaRequestedCommand>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(ResultWithError.Fail(new ErrorData(ErrorCodes.AuthenticationFailed)));

            var authenticationService            = new Mock <IAuthenticationService>();
            var currentAuthenticatedUserProvider = new Mock <ICurrentAuthenticatedUserProvider>();
            var page = new ValidateAppMfaCode(mediator.Object, authenticationService.Object,
                                              currentAuthenticatedUserProvider.Object);

            Assert.IsType <RedirectToPageResult>(await page.OnPostEmailMfaAsync());
            Assert.Equal(PrgState.Failed, page.PrgState);
        }
        public async Task OnPostEmailMfaAsync_GivenCommandSucceeds_ExpectRedirectAppMfaPage()
        {
            var mediator = new Mock <IMediator>();

            mediator.Setup(x => x.Send(It.IsAny <EmailMfaRequestedCommand>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(ResultWithError.Ok <ErrorData>());

            var authenticationService            = new Mock <IAuthenticationService>();
            var currentAuthenticatedUserProvider = new Mock <ICurrentAuthenticatedUserProvider>();
            var page = new ValidateAppMfaCode(mediator.Object, authenticationService.Object,
                                              currentAuthenticatedUserProvider.Object);

            var result = Assert.IsType <RedirectToPageResult>(await page.OnPostEmailMfaAsync());

            Assert.Equal(PageLocations.AuthEmailMfa, result.PageName);
        }