public void ApproveExample() { var engine = new ComparerEngine(); var diff = engine.CreateDiff("ExampleV1.dll", "ExampleV2.dll"); var stringBuilder = new StringWriter(); var formatter = new APIUpgradeToMarkdownFormatter(); formatter.WriteOut(diff, stringBuilder, new FormattingInfo(string.Empty, string.Empty)); Approvals.Verify(stringBuilder.ToString()); }
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); } }
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); } }
public void ApproveNServiceBus() { var packages = new[] { "4.6.4", "5.0.0-beta0004" }; var nugetCacheDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "NuGet", "Cache"); var repo = new AggregateRepository(new[] { PackageRepositoryFactory.Default.CreateRepository(nugetCacheDirectory), PackageRepositoryFactory.Default.CreateRepository("https://www.nuget.org/api/v2"), PackageRepositoryFactory.Default.CreateRepository("https://www.myget.org/F/particular/"), }); var packageManager = new PackageManager(repo, "packages"); foreach (var v in packages) { if (!Directory.Exists(Path.Combine("packages", "NServiceBus." + v))) packageManager.InstallPackage("NServiceBus", SemanticVersion.Parse(v)); } var file1 = Path.Combine("packages", "NServiceBus." + packages[0], "lib", "net40", "NServiceBus.Core.dll"); var file2 = Path.Combine("packages", "NServiceBus." + packages[1], "lib", "net45", "NServiceBus.Core.dll"); var engine = new ComparerEngine(); var diff = engine.CreateDiff(file1, file2); var stringBuilder = new StringWriter(); var formatter = new APIUpgradeToMarkdownFormatter(); formatter.WriteOut(diff, stringBuilder, new FormattingInfo(string.Empty, string.Empty)); Approvals.Verify(stringBuilder.ToString()); }