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

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

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

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