public void BuildRedirectReportMatchingNewUrl() { // create and build filtered redirect report 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 outputRedirectBuilder = new OutputRedirectBuilder (processedRedirectValidator); var outputRedirectReport = new OutputRedirectReport( outputRedirectBuilder, false); outputRedirectReport.Build(_redirectProcessingResult); // verify filtered redirect records are build var records = outputRedirectReport .GetRecords() .ToList(); Assert.AreEqual(1, records.Count); Assert.AreEqual( "http://www.test2.local/url3", records[0].OldUrl); Assert.AreEqual( "http://www.test2.local/url9", records[0].NewUrl); }
static void Reports( string outputDir, IRedirectProcessingResult redirectProcessingResult, IProcessedRedirectValidator processedRedirectValidator) { // create and write redirect summary report // ---------------------------------------- var redirectSummaryReportCsvFile = Path.Combine( outputDir, "redirect_summary.csv"); System.Console.ForegroundColor = ConsoleColor.Yellow; System.Console.WriteLine( string.Format( "Building and writing redirect summary report file '{0}'", redirectSummaryReportCsvFile)); var redirectSummaryReport = new RedirectSummaryReport( processedRedirectValidator); redirectSummaryReport.Build( redirectProcessingResult); redirectSummaryReport.WriteReportCsvFile( redirectSummaryReportCsvFile); System.Console.ForegroundColor = ConsoleColor.Green; System.Console.WriteLine("Done"); System.Console.WriteLine(string.Empty); // create and write old url domain report // -------------------------------------- var oldUrlDomainReportCsvFile = Path.Combine( outputDir, "oldurl_domains.csv"); System.Console.ForegroundColor = ConsoleColor.Yellow; System.Console.WriteLine( string.Format( "Building and writing old url domains report file '{0}'", oldUrlDomainReportCsvFile)); var oldUrlDomainReport = new OldUrlDomainReport(); oldUrlDomainReport.Build( redirectProcessingResult); oldUrlDomainReport.WriteReportCsvFile( oldUrlDomainReportCsvFile); System.Console.ForegroundColor = ConsoleColor.Green; System.Console.WriteLine("Done"); System.Console.WriteLine(string.Empty); // create and write new url domain report // -------------------------------------- var newUrlDomainReportCsvFile = Path.Combine( outputDir, "newurl_domains.csv"); System.Console.ForegroundColor = ConsoleColor.Yellow; System.Console.WriteLine( string.Format( "Building and writing new url domains report file '{0}'", newUrlDomainReportCsvFile)); var newUrlDomainReport = new NewUrlDomainReport(); newUrlDomainReport.Build( redirectProcessingResult); newUrlDomainReport.WriteReportCsvFile( newUrlDomainReportCsvFile); System.Console.ForegroundColor = ConsoleColor.Green; System.Console.WriteLine("Done"); System.Console.WriteLine(string.Empty); // create and write processed redirect report // ------------------------------------------ var processedRedirectReportCsvFile = Path.Combine( outputDir, "processed_redirects.csv"); System.Console.ForegroundColor = ConsoleColor.Yellow; System.Console.WriteLine( string.Format( "Building and writing processed redirects report file '{0}'", processedRedirectReportCsvFile)); var outputRedirectBuilder = new OutputRedirectBuilder( processedRedirectValidator); var processedRedirectReport = new ProcessedRedirectReport( outputRedirectBuilder); processedRedirectReport.Build( redirectProcessingResult); processedRedirectReport.WriteReportCsvFile( processedRedirectReportCsvFile); System.Console.ForegroundColor = ConsoleColor.Green; System.Console.WriteLine("Done"); System.Console.WriteLine(string.Empty); // create and write output redirect report // --------------------------------------- var outputRedirectReportCsvFile = Path.Combine( outputDir, "output_redirects.csv"); System.Console.ForegroundColor = ConsoleColor.Yellow; System.Console.WriteLine( string.Format( "Building and writing output redirects report file '{0}'", outputRedirectReportCsvFile)); var outputRedirectReport = new OutputRedirectReport( outputRedirectBuilder, false); outputRedirectReport.Build( redirectProcessingResult); outputRedirectReport.WriteReportCsvFile( outputRedirectReportCsvFile); System.Console.ForegroundColor = ConsoleColor.Green; System.Console.WriteLine("Done"); System.Console.WriteLine(string.Empty); // create and write output redirect including not matching new url report // ---------------------------------------------------------------------- var outputRedirectIncludingNotMatchingNewUrlReportCsvFile = Path.Combine( outputDir, "output_redirects_incl_not_matching.csv"); System.Console.ForegroundColor = ConsoleColor.Yellow; System.Console.WriteLine( string.Format( "Building and writing output redirects including not matching new url report file '{0}'", outputRedirectIncludingNotMatchingNewUrlReportCsvFile)); var outputRedirectIncludingNotMatchingNewUrlReport = new OutputRedirectReport( outputRedirectBuilder, true); outputRedirectIncludingNotMatchingNewUrlReport.Build( redirectProcessingResult); outputRedirectIncludingNotMatchingNewUrlReport.WriteReportCsvFile( outputRedirectIncludingNotMatchingNewUrlReportCsvFile); System.Console.ForegroundColor = ConsoleColor.Green; System.Console.WriteLine("Done"); System.Console.ForegroundColor = ConsoleColor.Gray; }