public void Handler_ReturnsClaims_FromAuthenticator_GetRemoteMembershipClaims() { const string authenticationType = DefaultAuthenticationTypes.ExternalBearer; var data = new[] { new Claim(ClaimTypes.Email, FakeData.Email()), new Claim(ClaimTypes.NameIdentifier, FakeData.Id() .ToString(CultureInfo.InvariantCulture)), new Claim(ClaimTypes.Gender, string.Empty), }; var authenticator = new Mock<IAuthenticate>(MockBehavior.Strict); authenticator.Setup(x => x.GetRemoteMembershipClaims(authenticationType)) .Returns(Task.FromResult(data as IEnumerable<Claim>)); var handler = new HandleExternalCookieClaimsQuery(authenticator.Object); var query = new ExternalCookieClaims(authenticationType); Claim[] result = handler.Handle(query).Result.ToArray(); Assert.NotNull(result); result.Length.ShouldEqual(3); result.ShouldEqual(data); authenticator.Verify(x => x.GetRemoteMembershipClaims(authenticationType), Times.Once); }
public void Query_Ctor_StringArg_SetsAuthenticationType_UsingArg() { string authenticationType = FakeData.String(); var query = new ExternalCookieClaims(authenticationType); query.AuthenticationType.ShouldEqual(authenticationType); }
public void Query_Ctor_NoArg_SetsAuthenticationType_ToDefaultExternalCookie() { var query = new ExternalCookieClaims(); query.AuthenticationType.ShouldEqual(DefaultAuthenticationTypes.ExternalCookie); }