public virtual async Task Match_DefaultValues(string template, string path, string[] keys, string[] values)
        {
            // Arrange
            var(matcher, endpoint)    = CreateMatcher(template);
            var(httpContext, context) = CreateContext(path);

            // Act
            await matcher.MatchAsync(httpContext, context);

            // Assert
            MatcherAssert.AssertMatch(context, httpContext, endpoint, keys, values);
        }
        public async Task Match_Port_NoHostHeader_InferHttpsPort()
        {
            // Arrange
            var endpoint = CreateEndpoint("/hello", hosts: new string[] { "*:443", });

            var matcher     = CreateMatcher(endpoint);
            var httpContext = CreateContext("/hello", null, "https");

            // Act
            await matcher.MatchAsync(httpContext);

            // Assert
            MatcherAssert.AssertMatch(httpContext, endpoint);
        }
        public async Task Match_HostWithPort_NoHostHeader()
        {
            // Arrange
            var endpoint = CreateEndpoint("/hello", hosts: new string[] { "contoso.com:443", });

            var matcher     = CreateMatcher(endpoint);
            var httpContext = CreateContext("/hello", null, "https");

            // Act
            await matcher.MatchAsync(httpContext);

            // Assert
            MatcherAssert.AssertNotMatch(httpContext);
        }
        public async Task Match_HostAndHostWithWildcard_NoSubdomain()
        {
            // Arrange
            var endpoint = CreateEndpoint("/hello", hosts: new string[] { "contoso.com:8080", "*.contoso.com:8080", });

            var matcher     = CreateMatcher(endpoint);
            var httpContext = CreateContext("/hello", "contoso.com:8080");

            // Act
            await matcher.MatchAsync(httpContext);

            // Assert
            MatcherAssert.AssertMatch(httpContext, endpoint);
        }
Beispiel #5
0
        public async Task Match_CatchAllRouteFailureHost_NoMatch()
        {
            // Arrange
            var endpoint = CreateEndpoint("/{**path}", hosts: new string[] { "contoso.com", });

            var matcher     = CreateMatcher(endpoint);
            var httpContext = CreateContext("/hello", "nomatch.com");

            // Act
            await matcher.MatchAsync(httpContext);

            // Assert
            MatcherAssert.AssertNotMatch(httpContext);
        }