public void AttemptRetrieveGoogleUserInformationWithInvalidAccessToken() { string accessToken = null; var action = new RetrieveGoogleUserInformationAction(accessToken, this.providerMock.Object); action.Execute(); this.WriteValidationContextRuleResults(action.ValidationContext); Assert.IsNull(action.UserInformation); }
public void CanRetrieveGoogleUserInformation() { string accessToken = this.RetrieveCurrentAccessToken(); var action = new RetrieveGoogleUserInformationAction(accessToken, this.providerMock.Object); action.Execute(); this.WriteValidationContextRuleResults(action.ValidationContext); Assert.IsNotNull(action.UserInformation); Assert.IsNotNullOrEmpty(action.UserInformation.Id.ToString()); Assert.IsNotNullOrEmpty(action.UserInformation.Email); Assert.IsNotNullOrEmpty(action.UserInformation.FullName); Assert.IsNotNullOrEmpty(action.UserInformation.FirstName); Assert.IsNotNullOrEmpty(action.UserInformation.LastName); Assert.IsNotNullOrEmpty(action.UserInformation.Domain); Assert.IsTrue(action.UserInformation.IsVerifiedEmail); Assert.IsNotNullOrEmpty(action.UserInformation.GoogleId); }
/// <summary> /// Retrieves the google user information. /// </summary> /// <param name="accessToken">The access token.</param> /// <returns></returns> public override UserInformation RetrieveGoogleUserInformation(string accessToken) { UserInformation user = null; RetrieveGoogleUserInformationAction action = new RetrieveGoogleUserInformationAction(accessToken, this); action.Execute(); if (action.Result == ActionResult.Success) { user = action.UserInformation; } return user; }