public void ValidateProcessedRedirectsOnlyMatchingNewUrls()
        {
            var configuration =
                TestData.TestData.DefaultConfiguration;
            var urlFormatter = new UrlFormatter();
            var urlParser    = new UrlParser();
            var urlHelper    = new UrlHelper(
                configuration,
                urlParser,
                urlFormatter);
            var processedRedirectValidator =
                new ProcessedRedirectValidator(
                    configuration,
                    urlHelper);

            var validProcessedRedirects = _processedRedirects
                                          .Where(x => processedRedirectValidator.IsValid(x, false))
                                          .ToList();

            Assert.AreEqual(
                1,
                validProcessedRedirects.Count);

            var urlResponseResult1 = validProcessedRedirects[0]
                                     .Results
                                     .OfType <UrlResponseResult>()
                                     .FirstOrDefault(r => r.Url != null && r.Url != null);

            Assert.AreEqual(
                "http://www.test2.local/url3",
                validProcessedRedirects[0].ParsedRedirect.OldUrl.Formatted);
            Assert.AreEqual(
                "http://www.test2.local/url9",
                urlResponseResult1.Url);
        }
        public void ExcludeRedirectsWhereOldUrlReturnedStatusCode200()
        {
            var configuration =
                TestData.TestData.DefaultConfiguration;
            var urlFormatter = new UrlFormatter();
            var urlParser    = new UrlParser();
            var urlHelper    = new UrlHelper(
                configuration,
                urlParser,
                urlFormatter);
            var processedRedirectValidator =
                new ProcessedRedirectValidator(
                    configuration,
                    urlHelper);

            var processedRedirects = new[]
            {
                new ProcessedRedirect
                {
                    ParsedRedirect = _redirectParser.ParseRedirect(
                        new Redirect
                    {
                        OldUrl = "http://www.test.local/url1",
                        NewUrl = "http://www.test.local/url2"
                    }),
                    Results = new[]
                    {
                        new UrlResponseResult
                        {
                            Type       = ResultTypes.UrlResponse,
                            Url        = "http://www.test.local/url1",
                            StatusCode = 200
                        }
                    }
                }
            };

            var validProcessedRedirects = processedRedirects
                                          .Where(x => processedRedirectValidator.IsValid(x, false))
                                          .ToList();

            Assert.AreEqual(
                0,
                validProcessedRedirects.Count);
        }