public void TestComplianceLibLog()
        {
            var formatter = new APIUpgradeToHtmlFormatter();
            var writer = new StringWriter();
            var packageDescription = new PackageDescription
            {
                PackageId = "LibLog",
                Versions = new VersionPair("3.0.0", "4.1.1")
            };
            var compareSetCreator = new CompareSetCreator();
            var sets = compareSetCreator.Create(packageDescription);
            var compareSetDiffer = new CompareSetDiffer();
            var diff = compareSetDiffer.Diff(sets);

            formatter.Render(writer, packageDescription, diff);

            Approvals.VerifyHtml(writer.ToString());
        }
        public void AppccelerateEventBrokerNoChanges()
        {
            var formatter = new APIUpgradeToHtmlFormatter();
            var writer = new StringWriter();
            var packageDescription = new PackageDescription
            {
                PackageId = "Appccelerate.EventBroker",
                Versions = new VersionPair("3.1.0", "3.15.0")
            };
            var compareSetCreator = new CompareSetCreator();
            var sets = compareSetCreator.Create(packageDescription);
            var compareSetDiffer = new CompareSetDiffer();
            var diff = compareSetDiffer.Diff(sets);

            formatter.Render(writer, packageDescription, diff);

            Approvals.VerifyHtml(writer.ToString());
        }
        private string HtmlDiff(string packageName, string fromVersion, string untilVersion)
        {
            using (var writer = new StringWriter())
            {
                var formatter = new APIUpgradeToHtmlFormatter();

                var packageDescription = new PackageDescription
                {
                    PackageId = packageName,
                    Versions = new VersionPair(fromVersion, untilVersion)
                };

                var compareSetCreator = new CompareSetCreator();
                var sets = compareSetCreator.Create(packageDescription);
                var compareSetDiffer = new CompareSetDiffer();
                var diff = compareSetDiffer.Diff(sets);

                formatter.Render(writer, packageDescription, diff);

                return writer.ToString();
            }
        }
        public void Handle(CompareNugetPackage message)
        {
            log.Info($"Received request to handle comparison for '{message.PackageId}' versions '{message.LeftVersion}' and '{message.RightVersion}'");

            var creator  = new CompareSetCreator();
            var differ   = new CompareSetDiffer();
            var reporter = new CompareSetReporter();

            var packageDescription = message.ToDescription();

            try
            {
                var compareSets       = creator.Create(packageDescription);
                var diffedCompareSets = differ.Diff(compareSets);
                reporter.Report(packageDescription, diffedCompareSets);
            }
            catch (Exception exception)
            {
                log.Info($"Failed to process request to handle comparison for '{message.PackageId}' versions '{message.LeftVersion}' and '{message.RightVersion}'");

                reporter.ReportFailure(packageDescription, exception);
            }
        }