public async Task TestMatchFramework() { var comparer = new NuGetDiff(); comparer.SearchPaths.AddRange(searchPaths); var diff = await comparer.GenerateAsync(SkiaPackageId, SkiaV600Number, SkiaV601Number); Assert.Equal(2, diff.AddedFrameworks.Length); Assert.Equal(2, diff.RemovedFrameworks.Length); Assert.Equal(7, diff.UnchangedFrameworks.Length); Assert.Single(diff.SimilarFrameworks); var mac2 = NuGetFramework.Parse("Xamarin.Mac,Version=v2.0"); var mac0 = NuGetFramework.Parse("Xamarin.Mac,Version=v0.0"); Assert.Contains(mac2, diff.SimilarFrameworks.Keys); Assert.Equal(mac0, diff.SimilarFrameworks[mac2]); const string mac2Dll = "lib/Xamarin.Mac20/SkiaSharp.dll"; const string mac0Dll = "lib/XamarinMac/SkiaSharp.dll"; Assert.Contains(mac2, diff.SimilarAssemblies.Keys); Assert.Contains((mac2Dll, mac0Dll), diff.SimilarAssemblies[mac2]); }
public async Task TestMatchNetStandardPortableReusePortable() { var comparer = new NuGetDiff(); comparer.SearchPaths.AddRange(searchPaths); var diff = await comparer.GenerateAsync(SkiaPackageId, SkiaV560Number, SkiaV600Number); Assert.Equal(2, diff.AddedFrameworks.Length); Assert.Empty(diff.RemovedFrameworks); Assert.Equal(7, diff.UnchangedFrameworks.Length); Assert.Single(diff.SimilarFrameworks); var netstd = NuGetFramework.Parse(".NETStandard,Version=v1.3"); var pcl = NuGetFramework.Parse(".NETPortable,Version=v0.0,Profile=Profile259"); Assert.Contains(netstd, diff.SimilarFrameworks.Keys); Assert.Equal(pcl, diff.SimilarFrameworks[netstd]); const string netstdDll = "lib/netstandard1.3/SkiaSharp.dll"; const string pclDll = "lib/portable-net45+win8+wpa81+wp8/SkiaSharp.dll"; Assert.Contains(netstd, diff.SimilarAssemblies.Keys); Assert.Contains((netstdDll, pclDll), diff.SimilarAssemblies[netstd]); }
public async Task TestCompareTwoLocalFiles() { var oldPath = GenerateTestOutputPath(); var newPath = GenerateTestOutputPath(); using (var wc = new WebClient()) { await wc.DownloadFileTaskAsync(FormsV20Url1, oldPath); await wc.DownloadFileTaskAsync(FormsV3Url2, newPath); } var comparer = new NuGetDiff(); comparer.SearchPaths.AddRange(searchPaths); var diff = await comparer.GenerateAsync(oldPath, newPath); Assert.Equal(NuGetVersion.Parse(FormsV20Number1), diff.OldIdentity.Version); Assert.Equal(NuGetVersion.Parse(FormsV30Number2), diff.NewIdentity.Version); Assert.NotEmpty(diff.AddedFrameworks); Assert.NotEmpty(diff.RemovedFrameworks); Assert.NotEmpty(diff.UnchangedFrameworks); Assert.NotEmpty(diff.AddedAssemblies); Assert.NotEmpty(diff.RemovedAssemblies); Assert.NotEmpty(diff.UnchangedAssemblies); }
public async Task TestComparePackage() { var comparer = new NuGetDiff(); comparer.SearchPaths.AddRange(searchPaths); var diff = await comparer.GenerateAsync(FormsPackageId, FormsV20Number1, FormsV30Number2); Assert.Equal(NuGetVersion.Parse(FormsV20Number1), diff.OldIdentity.Version); Assert.Equal(NuGetVersion.Parse(FormsV30Number2), diff.NewIdentity.Version); Assert.NotEmpty(diff.AddedFrameworks); Assert.NotEmpty(diff.RemovedFrameworks); Assert.NotEmpty(diff.UnchangedFrameworks); Assert.NotEmpty(diff.AddedAssemblies); Assert.NotEmpty(diff.RemovedAssemblies); Assert.NotEmpty(diff.UnchangedAssemblies); }