コード例 #1
0
        public void GetCorsPolicyAsync_PathEndsWithSlash_NormalizesPathCorrectly()
        {
            var origin = "http://foo.com";

            var subject = new TestCorsPolicyProvider(new string[] { "bar/" });

            var cp = subject.GetCorsPolicyAsync(Request(origin, "/bar")).Result;

            AssertAllowed(origin, cp);
        }
コード例 #2
0
        public void GetCorsPolicyAsync_NoMatchingPaths_DoesNotAllowOrigin()
        {
            var origin = "http://foo.com";

            var subject = new TestCorsPolicyProvider(new string[] { "/bar", "/baz", "/quux" });

            var cp = subject.GetCorsPolicyAsync(Request(origin, "/bad")).Result;

            cp.Should().BeNull();
        }
コード例 #3
0
        public void GetCorsPolicyAsync_MatchingPaths_AllowsOrigin()
        {
            var origin = "http://foo.com";

            var subject = new TestCorsPolicyProvider(new string[] { "/bar", "/baz", "/quux" });

            var cp = subject.GetCorsPolicyAsync(Request(origin, "/baz")).Result;

            AssertAllowed(origin, cp);
        }
コード例 #4
0
        public void GetCorsPolicyAsync_MatchingPath_AllowsOrigin()
        {
            var origin = "http://foo.com";
            var path = "/bar";

            var subject = new TestCorsPolicyProvider(new string[] { path });

            var cp = subject.GetCorsPolicyAsync(Request(origin, path)).Result;
            AssertAllowed(origin, cp);
        }
コード例 #5
0
        public void GetCorsPolicyAsync_NoOrigin_DoesNotAllowrigin()
        {
            string origin = null;
            var    path   = "/bar";

            var subject = new TestCorsPolicyProvider(new string[] { path });

            var cp = subject.GetCorsPolicyAsync(Request(origin, path)).Result;

            cp.Should().BeNull();
        }
コード例 #6
0
        public void GetCorsPolicyAsync_PathEndsWithSlash_NormalizesPathCorrectly()
        {
            var origin = "http://foo.com";

            var subject = new TestCorsPolicyProvider(new string[] { "bar/" });

            var cp = subject.GetCorsPolicyAsync(Request(origin, "/bar")).Result;
            AssertAllowed(origin, cp);
        }
コード例 #7
0
        public void GetCorsPolicyAsync_NoMatchingPaths_DoesNotAllowOrigin()
        {
            var origin = "http://foo.com";

            var subject = new TestCorsPolicyProvider(new string[] { "/bar", "/baz", "/quux" });

            var cp = subject.GetCorsPolicyAsync(Request(origin, "/bad")).Result;
            cp.Should().BeNull();
        }
コード例 #8
0
        public void GetCorsPolicyAsync_NoOrigin_DoesNotAllowrigin()
        {
            string origin = null;
            var path = "/bar";

            var subject = new TestCorsPolicyProvider(new string[] { path });

            var cp = subject.GetCorsPolicyAsync(Request(origin, path)).Result;
            cp.Should().BeNull();
        }