Exemple #1
0
    internal async Task <Index> Send2FACodeAsync(string twoFactorKey)
    {
        var code = EnableAuthenticator.ComputeCode(twoFactorKey);

        var response = await Client.SendAsync(_twoFactorForm, new Dictionary <string, string>
        {
            ["Input_TwoFactorCode"] = code
        });

        var goToIndex = ResponseAssert.IsRedirect(response);

        Assert.Equal(Index.Path, goToIndex.ToString());
        var indexResponse = await Client.GetAsync(goToIndex);

        var index = await ResponseAssert.IsHtmlDocumentAsync(indexResponse);

        return(new Index(Client, index, Context.WithAuthenticatedUser()));
    }