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"))); }); }
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); }
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); }