Esempio n. 1
0
        public void AddAfterAnyFails()
        {
            var endpoint = new Endpoint("Mock service", "^/NHNPersonvern/");

            endpoint.Add(new AnyMatcher(), new LiteralResponse("foobar", new Endpoint("a", "b")));

            Assert.Throws(typeof(ArgumentException), () => {
                endpoint.Add(new RegexMatcher("foo"), new LiteralResponse("foobar", new Endpoint("a", "b")));
            });
        }
Esempio n. 2
0
        public void ResolveOnlyOne()
        {
            var endpoint = new Endpoint("Mock service", "^/NHNPersonvern/");

            endpoint.Add(new RegexMatcher("foo"), new LiteralResponse("foobar", new Endpoint("a", "b")));
            endpoint.Add(new AnyMatcher(), new LiteralResponse("foobar", new Endpoint("a", "b")));

            var firstmatch = endpoint.Resolve("GET", new Microsoft.AspNetCore.Http.PathString(""), new Microsoft.AspNetCore.Http.QueryString(), "bar", null);

            Assert.True(firstmatch.SingleMatch);
            Assert.IsType <AnyMatcher>(firstmatch.RequestMatcher);
        }
Esempio n. 3
0
        public void ResolveMoreThanOneMatcher()
        {
            var endpoint = new Endpoint("Mock service", "^/NHNPersonvern/");

            endpoint.Add(new RegexMatcher("foo"), new LiteralResponse("foobar"));
            endpoint.Add(new AnyMatcher(), new LiteralResponse("foobar"));

            var firstmatch = endpoint.Resolve(new Microsoft.AspNetCore.Http.PathString(""), new Microsoft.AspNetCore.Http.QueryString(""), "foo", null);

            Assert.False(firstmatch.SingleMatch);
            Assert.IsType(typeof(RegexMatcher), firstmatch.RequestMatcher);
        }