Exemple #1
0
        public void Given_uriString_when_matching_should_match(string uriString, bool hasWildcard, string requestUri, bool isMatch)
        {
            var request = new HttpRequestMessage
            {
                RequestUri = new Uri(requestUri, UriKind.Absolute)
            };

            _sut = new RequestUriMatcher(uriString, hasWildcard);

            // Act & assert
            _sut.IsMatch(new MockHttpRequestContext(request)).Should().Be(isMatch);
        }
Exemple #2
0
        public void Given_null_context_when_matching_it_should_throw()
        {
            _sut = new RequestUriMatcher("*/controller/*");
            MockHttpRequestContext requestContext = null;

            // Act
            // ReSharper disable once ExpressionIsAlwaysNull
            Action act = () => _sut.IsMatch(requestContext);

            // Assert
            act.Should()
            .Throw <ArgumentNullException>()
            .WithParamName(nameof(requestContext));
        }