コード例 #1
0
    public void GetNormalizedOrigin_ReturnsPunyCodedOrigin(string origin, string expected)
    {
        // Act
        var normalizedOrigin = CorsPolicyBuilder.GetNormalizedOrigin(origin);

        // Assert
        Assert.Equal(expected, normalizedOrigin);
    }
コード例 #2
0
    public void GetNormalizedOrigin_PreservesPort_ForNonIdnHosts(string origin, string expected)
    {
        // Act
        var normalizedOrigin = CorsPolicyBuilder.GetNormalizedOrigin(origin);

        // Assert
        Assert.Equal(expected, normalizedOrigin);
    }
コード例 #3
0
    public void GetNormalizedOrigin_ReturnsLowerCasedValue_IfStringIsNotHttpOrHttpsUrl(string origin, string expected)
    {
        // Act
        var normalizedOrigin = CorsPolicyBuilder.GetNormalizedOrigin(origin);

        // Assert
        Assert.Equal(expected, normalizedOrigin);
    }
コード例 #4
0
    public void GetNormalizedOrigin_LowerCasesHost()
    {
        // Arrange
        var origin = "http://www.Example.Com";

        // Act
        var normalizedOrigin = CorsPolicyBuilder.GetNormalizedOrigin(origin);

        // Assert
        Assert.Equal("http://www.example.com", normalizedOrigin);
    }
コード例 #5
0
    public void GetNormalizedOrigin_DoesNotAddPort_IfUriDoesNotSpecifyOne()
    {
        // Arrange
        var origin = "http://www.example.com";

        // Act
        var normalizedOrigin = CorsPolicyBuilder.GetNormalizedOrigin(origin);

        // Assert
        Assert.Equal(origin, normalizedOrigin);
    }