示例#1
0
        public void FullIntegrationTest(string readmePath)
        {
            var repositoryPath = Path.Combine(Directory.GetCurrentDirectory(), "..", "..", "..", "..");

            repositoryPath = Path.GetFullPath(repositoryPath);
            var verifyLinksService = new LinkVerifierService(repositoryPath, readmePath);
            var result             = verifyLinksService.VerifyLinks();

            AssertLinkWereClassifiedCorrectly(result);
        }
        private static void RunVerifyLinks(Options options)
        {
            try
            {
                var verifyLinksService = new LinkVerifierService(options.RepositoryPath, options.ReadmePath);
                var result             = verifyLinksService.VerifyLinks();
                if (!options.OnlyPrintBadLinks)
                {
                    PrintResults(result.GoodLinks, nameof(result.GoodLinks));
                    PrintResults(result.UnknownLinks, nameof(result.UnknownLinks));
                }
                PrintResults(result.BadLinks, nameof(result.BadLinks));

                if (result.BadLinks.Any())
                {
                    Environment.Exit(-2);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("Oops: " + e.Message);
                Environment.Exit(-1);
            }
        }