コード例 #1
0
        public void MatchesExpressionsThrowsExceptionWithNullActualLocationTest()
        {
            var target = new CompositeLocationValidator();

            Action action = () => target.Matches(null, new List <Regex>());

            action.ShouldThrow <ArgumentNullException>();
        }
コード例 #2
0
        public void MatchesExpressionsThrowsExceptionWithRelativeActualLocationTest()
        {
            var actualLocation = new Uri("/some/time/", UriKind.Relative);

            var target = new CompositeLocationValidator();

            Action action = () => target.Matches(actualLocation, new List <Regex>());

            action.ShouldThrow <ArgumentException>();
        }
コード例 #3
0
        public void MatchesExpressionsThrowsExceptionWithNullExpressionsTest()
        {
            var actualLocation = new Uri("http://www.test.com/some/time/");

            var target = new CompositeLocationValidator();

            Action action = () => target.Matches(actualLocation, (IEnumerable <Regex>)null);

            action.ShouldThrow <ArgumentNullException>();
        }
コード例 #4
0
        public void MatchesExpressionsReturnsFalseWhenNoExpressionsProvidedTest()
        {
            var actualLocation = new Uri("http://www.test.com/some/time/");
            var expressions = new List<Regex>();

            var target = new CompositeLocationValidator();

            var actual = target.Matches(actualLocation, expressions);

            actual.Should().BeFalse();
        }
コード例 #5
0
        public void MatchesExpressionsReturnsFalseWhenNoExpressionsProvidedTest()
        {
            var actualLocation = new Uri("http://www.test.com/some/time/");
            var expressions    = new List <Regex>();

            var target = new CompositeLocationValidator();

            var actual = target.Matches(actualLocation, expressions);

            actual.Should().BeFalse();
        }
コード例 #6
0
        public void MatchesExpressionsReturnsFalseWhenNoExpressionMatchesLocationTest()
        {
            var actualLocation = new Uri("http://www.test.com/customers/1233/products");
            var expressions = new List<Regex>
            {
                new Regex("http://www\\.test\\.com/customers/\\D+/products(/)?$")
            };

            var target = new CompositeLocationValidator();

            var actual = target.Matches(actualLocation, expressions);

            actual.Should().BeFalse();
        }
コード例 #7
0
        public void MatchesExpressionsReturnsTrueWhenSingleExpressionMatchesLocationTest()
        {
            var actualLocation = new Uri("http://www.test.com/customers/1233/products");
            var expressions    = new List <Regex>
            {
                new Regex("http://www\\.test\\.com/customers/\\d+/products(/)?$")
            };

            var target = new CompositeLocationValidator();

            var actual = target.Matches(actualLocation, expressions);

            actual.Should().BeTrue();
        }
コード例 #8
0
        public void MatchesExpressionsThrowsExceptionWithNullActualLocationTest()
        {
            var target = new CompositeLocationValidator();

            Action action = () => target.Matches(null, new List<Regex>());

            action.ShouldThrow<ArgumentNullException>();
        }
コード例 #9
0
        public void MatchesExpressionsThrowsExceptionWithRelativeActualLocationTest()
        {
            var actualLocation = new Uri("/some/time/", UriKind.Relative);

            var target = new CompositeLocationValidator();

            Action action = () => target.Matches(actualLocation, new List<Regex>());

            action.ShouldThrow<ArgumentException>();
        }
コード例 #10
0
        public void MatchesExpressionsThrowsExceptionWithNullExpressionsTest()
        {
            var actualLocation = new Uri("http://www.test.com/some/time/");

            var target = new CompositeLocationValidator();

            Action action = () => target.Matches(actualLocation, (IEnumerable<Regex>)null);

            action.ShouldThrow<ArgumentNullException>();
        }