public static async Task <Index> CreateAsync(HttpClient client, DefaultUIContext context = null) { var goToIndex = await client.GetAsync("/"); var index = await ResponseAssert.IsHtmlDocumentAsync(goToIndex); return(new Index(client, index, context ?? new DefaultUIContext())); }
internal async Task <DeleteUser> ClickDeleteLinkAsync() { var goToDelete = await Client.GetAsync(_deleteLink.Href); var delete = await ResponseAssert.IsHtmlDocumentAsync(goToDelete); return(new DeleteUser(Client, delete, Context.WithAnonymousUser())); }
public async Task <ChangePassword> ClickChangePasswordLinkAsync() { var goToChangePassword = await Client.GetAsync(_changePasswordLink.Href); var changePasswordDocument = await ResponseAssert.IsHtmlDocumentAsync(goToChangePassword); return(new ChangePassword(Client, changePasswordDocument, Context)); }
public async Task <TwoFactorAuthentication> ClickTwoFactorLinkAsync(bool twoFactorEnabled) { var goToTwoFactor = await Client.GetAsync(_twoFactorLink.Href); var twoFactor = await ResponseAssert.IsHtmlDocumentAsync(goToTwoFactor); return(new TwoFactorAuthentication(Client, twoFactor, Context, twoFactorEnabled)); }
public async Task <ExternalLogins> ClickExternalLoginsAsync() { var goToExternalLogin = await Client.GetAsync(_externalLoginLink.Href); var externalLoginDocument = await ResponseAssert.IsHtmlDocumentAsync(goToExternalLogin); return(new ExternalLogins(Client, externalLoginDocument, Context)); }
internal async Task <ResetAuthenticator> ClickResetAuthenticatorLinkAsync() { var goToResetAuthenticator = await Client.GetAsync(_resetAuthenticatorLink.Href); var resetAuthenticator = await ResponseAssert.IsHtmlDocumentAsync(goToResetAuthenticator); return(new ResetAuthenticator(Client, resetAuthenticator, Context)); }
public async Task <ForgotPassword> ClickForgotPasswordLinkAsync() { var response = await Client.GetAsync(_forgotPasswordLink.Href); var forgotPassword = await ResponseAssert.IsHtmlDocumentAsync(response); return(new ForgotPassword(Client, forgotPassword, Context)); }
public async Task <Email> ClickEmailLinkAsync() { var goToEmail = await Client.GetAsync(_emailLink.Href); var email = await ResponseAssert.IsHtmlDocumentAsync(goToEmail); return(new Email(Client, email, Context)); }
public static async Task <ConfirmEmail> Create(IHtmlAnchorElement link, HttpClient client, DefaultUIContext context) { var response = await client.GetAsync(link.Href); var confirmEmail = await ResponseAssert.IsHtmlDocumentAsync(response); return(new ConfirmEmail(client, confirmEmail, context)); }
public async Task <ResendEmailConfirmation> ClickReconfirmEmailLinkAsync() { var response = await Client.GetAsync(_reconfirmLink.Href); var forgotPassword = await ResponseAssert.IsHtmlDocumentAsync(response); return(new ResendEmailConfirmation(Client, forgotPassword, Context)); }
public async Task <PersonalData> ClickPersonalDataLinkAsync() { var goToPersonalData = await Client.GetAsync(_personalDataLink.Href); var personalData = await ResponseAssert.IsHtmlDocumentAsync(goToPersonalData); return(new PersonalData(Client, personalData, Context)); }
internal static async Task <ResetPassword> CreateAsync(IHtmlAnchorElement link, HttpClient client, DefaultUIContext context) { var resetPasswordResponse = await client.GetAsync(link.Href); var resetPassword = await ResponseAssert.IsHtmlDocumentAsync(resetPasswordResponse); return(new ResetPassword(client, resetPassword, context)); }
internal async Task <LoginWithRecoveryCode> ClickRecoveryCodeLinkAsync() { var goToLoginWithRecoveryCode = await Client.GetAsync(_loginWithRecoveryCodeLink.Href); var loginWithRecoveryCode = await ResponseAssert.IsHtmlDocumentAsync(goToLoginWithRecoveryCode); return(new LoginWithRecoveryCode(Client, loginWithRecoveryCode, Context)); }
public async Task <ConfirmEmail> ClickConfirmLinkAsync() { var goToConfirm = await Client.GetAsync(_confirmLink.Href); var confirm = await ResponseAssert.IsHtmlDocumentAsync(goToConfirm); return(await ConfirmEmail.Create(_confirmLink, Client, Context)); }
internal async Task <Account.Manage.Index> ClickManageLinkAsync() { Assert.True(Context.UserAuthenticated); var goToManage = await Client.GetAsync(_manageLink.Href); var manage = await ResponseAssert.IsHtmlDocumentAsync(goToManage); return(new Account.Manage.Index(Client, manage, Context)); }
public async Task <Login> ClickLoginLinkAsync() { Assert.False(Context.UserAuthenticated); var goToLogin = await Client.GetAsync(_loginLink.Href); var login = await ResponseAssert.IsHtmlDocumentAsync(goToLogin); return(new Login(Client, login, Context)); }
public async Task <Register> ClickRegisterLinkAsync() { Assert.False(Context.UserAuthenticated); var goToRegister = await Client.GetAsync(_registerLink.Href); var register = await ResponseAssert.IsHtmlDocumentAsync(goToRegister); return(new Register(Client, register, Context)); }
public async Task <TwoFactorAuthentication> ClickTwoFactorEnabledLinkAsync() { var goToTwoFactor = await Client.GetAsync(_twoFactorLink.Href); var twoFactor = await ResponseAssert.IsHtmlDocumentAsync(goToTwoFactor); Context.TwoFactorEnabled = true; Context.CookiePolicyAccepted = true; return(new TwoFactorAuthentication(Client, twoFactor, Context)); }
internal async Task <EnableAuthenticator> ClickEnableAuthenticatorLinkAsync() { Assert.False(_twoFactorEnabled); var goToEnableAuthenticator = await Client.GetAsync(_enableAuthenticatorLink.Href); var enableAuthenticator = await ResponseAssert.IsHtmlDocumentAsync(goToEnableAuthenticator); return(new EnableAuthenticator(Client, enableAuthenticator, Context)); }
public async Task <Contoso.Login> ClickLoginWithContosoLinkAsync() { var externalFormResponse = await Client.SendAsync(_externalLoginForm, _contosoButton); var goToContosoLogin = ResponseAssert.IsRedirect(externalFormResponse); var contosoLoginResponse = await Client.GetAsync(goToContosoLogin); var contosoLogin = await ResponseAssert.IsHtmlDocumentAsync(contosoLoginResponse); return(new Contoso.Login(Client, contosoLogin, Context)); }
public async Task <SetPassword> ClickChangePasswordLinkExternalLoginAsync() { var response = await Client.GetAsync(_changePasswordLink.Href); var goToSetPassword = ResponseAssert.IsRedirect(response); var setPasswordResponse = await Client.GetAsync(goToSetPassword); var setPasswordDocument = await ResponseAssert.IsHtmlDocumentAsync(setPasswordResponse); return(new SetPassword(Client, setPasswordDocument, Context)); }
public async Task AnonymousUserCanAccessNotAuthorizedPages(string url) { // Arrange var client = ServerFactory .CreateClient(); // Act var response = await client.GetAsync(url); // Assert await ResponseAssert.IsHtmlDocumentAsync(response); }
internal async Task <Account.Manage.Index> ClickManageLinkWithExternalLoginAsync() { Assert.True(Context.UserAuthenticated); var goToManage = await Client.GetAsync(_manageLink.Href); var manage = await ResponseAssert.IsHtmlDocumentAsync(goToManage); return(new Account.Manage.Index(Client, manage, Context .WithSocialLoginEnabled() .WithSocialLoginProvider())); }
public async Task <FunctionalTests.Index> Delete(string password) { var loggedIn = await SendDeleteForm(password); var deleteLocation = ResponseAssert.IsRedirect(loggedIn); Assert.Equal(Index.Path, deleteLocation.ToString()); var indexResponse = await Client.GetAsync(deleteLocation); var index = await ResponseAssert.IsHtmlDocumentAsync(indexResponse); return(new FunctionalTests.Index(Client, index, Context)); }
internal async Task <Index> SendConfirmationEmailAsync() { Assert.False(Context.EmailConfirmed); var response = await Client.SendAsync(_updateProfileForm, _confirmEmailButton); var goToManage = ResponseAssert.IsRedirect(response); var manageResponse = await Client.GetAsync(goToManage); var manage = await ResponseAssert.IsHtmlDocumentAsync(manageResponse); return(new Index(Client, manage, Context)); }
public async Task <ManageExternalLogin> LinkExternalLoginAsync(string loginEmail) { // Click on the button to link external login to current user account var linkExternalLogin = await Client.SendAsync(_linkLoginForm, _linkLoginButton); var goToLinkExternalLogin = ResponseAssert.IsRedirect(linkExternalLogin); var externalLoginResponse = await Client.GetAsync(goToLinkExternalLogin); var externalLoginDocument = await ResponseAssert.IsHtmlDocumentAsync(externalLoginResponse); // Redirected to manage page for external login with a remove button return(new ManageExternalLogin(Client, externalLoginDocument, Context)); }
public async Task <LoginWith2fa> PasswordLoginValidUserWith2FaAsync(string userName, string password) { var loggedIn = await SendLoginForm(userName, password); var loggedInLocation = ResponseAssert.IsRedirect(loggedIn); Assert.StartsWith(LoginWith2fa.Path, loggedInLocation.ToString()); var loginWithTwoFactorResponse = await Client.GetAsync(loggedInLocation); var loginWithTwoFactor = await ResponseAssert.IsHtmlDocumentAsync(loginWithTwoFactorResponse); return(new LoginWith2fa(Client, loginWithTwoFactor, Context)); }
public async Task <Index> LoginValidUserAsync(string userName, string password) { var loggedIn = await SendLoginForm(userName, password); var loggedInLocation = ResponseAssert.IsRedirect(loggedIn); Assert.Equal(Index.Path, loggedInLocation.ToString()); var indexResponse = await Client.GetAsync(loggedInLocation); var index = await ResponseAssert.IsHtmlDocumentAsync(indexResponse); return(new Index(Client, index, Context, authenticated: true)); }
public async Task <Index> SendEmailAsync(string email) { var response = await Client.SendAsync(_emailForm, new Dictionary <string, string> { ["Input_Email"] = email }); var redirect = ResponseAssert.IsRedirect(response); var indexResponse = await Client.GetAsync(redirect); var index = await ResponseAssert.IsHtmlDocumentAsync(indexResponse); return(new Index(Client, index, Context.WithAuthenticatedUser())); }
public async Task <Index> SendRecoveryCodeAsync(string recoveryCode) { var response = await Client.SendAsync(_loginWithRecoveryCodeForm, new Dictionary <string, string> { ["Input_RecoveryCode"] = recoveryCode }); var goToIndex = ResponseAssert.IsRedirect(response); var indexPage = await Client.GetAsync(goToIndex); var index = await ResponseAssert.IsHtmlDocumentAsync(indexPage); return(new Index(Client, index, Context.WithAuthenticatedUser())); }