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

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

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

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

            mediator.Setup(x => x.Send(It.IsAny <DeviceMfaRequestCommand>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(
                Result.Ok <DeviceMfaRequestCommandResult, ErrorData>(
                    new DeviceMfaRequestCommandResult(new AssertionOptions())));

            var authenticationService            = new Mock <IAuthenticationService>();
            var currentAuthenticatedUserProvider = new Mock <ICurrentAuthenticatedUserProvider>();
            var page = new ValidateEmailMfaCode(mediator.Object, authenticationService.Object,
                                                currentAuthenticatedUserProvider.Object)
            {
                TempData = new Mock <ITempDataDictionary>().Object,
            };

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

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