public GetExternalUserInformation ( Microsoft.AspNetCore.Identity.ExternalLoginInfo externalLoginInfo ) : Task |
||
externalLoginInfo | Microsoft.AspNetCore.Identity.ExternalLoginInfo | |
리턴 | Task |
public async Task ReturnCorrectExternalLoginInfoWhenNameClaimIsNull() { const string email = "email"; var claimsPrincipal = new ClaimsPrincipal(new ClaimsIdentity(new[] { new Claim(ClaimTypes.Email, email) })); var sut = new MicrosoftAndFacebookExternalUserInformationProvider(); var result = await sut.GetExternalUserInformation(new ExternalLoginInfo(claimsPrincipal, null, null, null)); Assert.Equal(result.Email, email); Assert.Null(result.FirstName); Assert.Null(result.LastName); }
public async Task ReturnCorrectExternalLoginInfoWhenNameClaimContainsASpace() { const string email = "email"; const string name = "first last"; var claimsPrincipal = new ClaimsPrincipal(new ClaimsIdentity(new[] { new Claim(ClaimTypes.Email, email), new Claim(ClaimTypes.Name, name) })); var splitName = name.Split(' '); var sut = new MicrosoftAndFacebookExternalUserInformationProvider(); var result = await sut.GetExternalUserInformation(new ExternalLoginInfo(claimsPrincipal, null, null, null)); Assert.Equal(result.Email, email); Assert.Equal(result.FirstName, splitName[0]); Assert.Equal(result.LastName, splitName[1]); }