Ejemplo n.º 1
0
    public void GetClaimValue_ShouldReturnNullWhenValueNotFound()
    {
        var    principal = CreatePrincipal("ClaimType", "TestValue");
        string?result    = ClaimsPrincipalExtensions.GetClaimValue(principal, "DifferentClaimType");

        result.ShouldBeNull();
    }
Ejemplo n.º 2
0
    public void GetClaimValue_ShouldReturnCorrectValueWhenFound()
    {
        var    principal = CreatePrincipal("ClaimType", "TestValue");
        string?result    = ClaimsPrincipalExtensions.GetClaimValue(principal, "ClaimType");

        result.ShouldBe("TestValue");
    }
Ejemplo n.º 3
0
    public void GetClaimValue_ShouldThrowAnExceptionWhenClaimTypeIsEmptyString()
    {
        var principal = CreatePrincipal("ClaimType", "TestValue");

        Should.Throw <ArgumentException>(() => ClaimsPrincipalExtensions.GetClaimValue(principal, string.Empty));
    }