public void MatchesExpressionsThrowsExceptionWithNullActualLocationTest()
        {
            var target = new CompositeLocationValidator();

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

            action.ShouldThrow <ArgumentNullException>();
        }
        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>();
        }
        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>();
        }
        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();
        }
        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();
        }
        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();
        }
        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();
        }
        public void MatchesExpressionsThrowsExceptionWithNullActualLocationTest()
        {
            var target = new CompositeLocationValidator();

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

            action.ShouldThrow<ArgumentNullException>();
        }
        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>();
        }
        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>();
        }