예제 #1
0
        public void Report(PackageDescription description, DiffedCompareSet[] diffedCompareSets)
        {
            var resultPath = DetermineAndCreateResultPathIfNotExistant(description);

            using (var fileStream = File.OpenWrite(resultPath))
            using (var into = new StreamWriter(fileStream))
            {
                var formatter = new APIUpgradeToHtmlFormatter();
                formatter.Render(into, description, diffedCompareSets);

                @into.Flush();
                @into.Close();
                fileStream.Close();
            }
            RemoveTemporaryWorkFiles(resultPath);
        }
        public void TestComplianceNewtonsoftJson()
        {
            var formatter = new APIUpgradeToHtmlFormatter();
            var writer = new StringWriter();
            var packageDescription = new PackageDescription
            {
                PackageId = "newtonsoft.json",
                Versions = new VersionPair("5.0.8", "6.0.8")
            };
            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());
        }
        public void TestComplianceAzureSelfDestruct()
        {
            var formatter = new APIUpgradeToHtmlFormatter();
            var writer = new StringWriter();
            var packageDescription = new PackageDescription
            {
                PackageId = "Two10.Azure.SelfDestruct",
                Versions = new VersionPair("1.0.0", "1.0.5")
            };
            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();
            }
        }