Пример #1
0
    private static void Compare(CompareSet compareSet, bool showAllVersions = true)
    {
        var engine = new ComparerEngine();

        var diff = engine.CreateDiff(compareSet.LeftAssemblyGroup, compareSet.RightAssemblyGroup);

        var breakingChanges = BreakingChangeFinder.Find(diff)
            .ToList();

        if (showAllVersions || breakingChanges.Any())
        {
            Console.Out.Write("Checking {0}", compareSet);

            if (breakingChanges.Any())
            {
                Console.Out.Write(": {0} Breaking Changes found", breakingChanges.Count);
            }
            else
            {
                Console.Out.Write(" No breaking changes found");
            }

            var resultFile = Path.Combine(Path.GetTempPath(),Guid.NewGuid() + ".md");

            using (var fileStream = File.OpenWrite(resultFile))
            using (var into = new StreamWriter(fileStream))
            {
                var formatter = new APIUpgradeToMarkdownFormatter();
                formatter.WriteOut(diff, into, new FormattingInfo("tbd", "tbd"));

                into.Flush();
                into.Close();
                fileStream.Close();
            }

            Process.Start(resultFile);
        }
    }
Пример #2
0
    private static void Compare(CompareSet compareSet,bool showAllVersions = true)
    {
        var engine = new ComparerEngine();

        var diff = engine.CreateDiff(compareSet.LeftAssemblyGroup, compareSet.RightAssemblyGroup);

        var breakingChanges = BreakingChangeFinder.Find(diff)
            .ToList();

        if (showAllVersions || breakingChanges.Any())
        {
            Console.Out.Write("Checking {0}", compareSet);

            if (breakingChanges.Any())
            {
                Console.Out.Write(": {0} Breaking Changes found", breakingChanges.Count);
            }
            else
            {
                Console.Out.Write(" OK");
            }

            var resultFile = string.Format("{0}-{1}..{2}.md", compareSet.Name, compareSet.Versions.LeftVersion, compareSet.Versions.RightVersion);
            using (var fileStream = File.OpenWrite(resultFile))
            using(var into = new StreamWriter(fileStream))
            {
                var formatter = new APIUpgradeToMarkdownFormatter();
                formatter.WriteOut(diff, into, new FormattingInfo("tbd", "tbd"));

                into.Flush();
                into.Close();
                fileStream.Close();
            }

            Console.Out.WriteLine(", Full report written to " + resultFile);
        }
    }