public void GetClaimValue_ShouldReturnNullWhenValueNotFound() { var principal = CreatePrincipal("ClaimType", "TestValue"); string?result = ClaimsPrincipalExtensions.GetClaimValue(principal, "DifferentClaimType"); result.ShouldBeNull(); }
public void GetClaimValue_ShouldReturnCorrectValueWhenFound() { var principal = CreatePrincipal("ClaimType", "TestValue"); string?result = ClaimsPrincipalExtensions.GetClaimValue(principal, "ClaimType"); result.ShouldBe("TestValue"); }
public void GetClaimValue_ShouldThrowAnExceptionWhenClaimTypeIsEmptyString() { var principal = CreatePrincipal("ClaimType", "TestValue"); Should.Throw <ArgumentException>(() => ClaimsPrincipalExtensions.GetClaimValue(principal, string.Empty)); }