public void ClaimsIdentityBuilder_WithName_CallsWrongClaim_ShouldThrowInvalidOperationException() { ClaimsIdentityBuilder builder = new ClaimsIdentityBuilder(); ClaimsIdentity claimsIdentity = builder.WithName("Handsome B. Wonderful").Build(); Assert.ThrowsException <InvalidOperationException>(() => claimsIdentity.Claims.First(x => x.Type == ClaimTypes.NameIdentifier).Value); }
public void ClaimsIdentityBuilder_WithName_ShouldSetClaim() { ClaimsIdentityBuilder builder = new ClaimsIdentityBuilder(); ClaimsIdentity claimsIdentity = builder.WithName("Handsome B. Wonderful").Build(); string name = claimsIdentity.Claims.First(x => x.Type == ClaimTypes.Name).Value; Assert.IsTrue(name == "Handsome B. Wonderful"); }