From 73f7fc1db99271e7638c4892247a003b330c7c39 Mon Sep 17 00:00:00 2001 From: Joel Verhagen Date: Tue, 3 May 2016 09:03:38 -0700 Subject: [PATCH 1/3] Add Xamarin.Mac.NET (xamarinmacnet45) Address NuGet/Home#2662 --- .../DefaultFrameworkMappings.cs | 23 +++++++++++ .../NuGet.Frameworks/FrameworkConstants.cs | 1 + .../CompatibilityListProviderTests.cs | 5 ++- .../CompatibilityTests.cs | 39 +++++++++++++++++++ .../FrameworkReducerTests.cs | 14 +++++++ .../NuGetFrameworkParseTests.cs | 2 + 6 files changed, 83 insertions(+), 1 deletion(-) diff --git a/src/NuGet.Core/NuGet.Frameworks/DefaultFrameworkMappings.cs b/src/NuGet.Core/NuGet.Frameworks/DefaultFrameworkMappings.cs index 68fbdbbe913..06402678bba 100644 --- a/src/NuGet.Core/NuGet.Frameworks/DefaultFrameworkMappings.cs +++ b/src/NuGet.Core/NuGet.Frameworks/DefaultFrameworkMappings.cs @@ -80,6 +80,7 @@ public IEnumerable> IdentifierShortNames new KeyValuePair(FrameworkConstants.FrameworkIdentifiers.MonoMac, "monomac"), new KeyValuePair(FrameworkConstants.FrameworkIdentifiers.XamarinIOs, "xamarinios"), new KeyValuePair(FrameworkConstants.FrameworkIdentifiers.XamarinMac, "xamarinmac"), + new KeyValuePair(FrameworkConstants.FrameworkIdentifiers.XamarinMacNet, "xamarinmacnet"), new KeyValuePair(FrameworkConstants.FrameworkIdentifiers.XamarinPlayStation3, "xamarinpsthree"), new KeyValuePair(FrameworkConstants.FrameworkIdentifiers.XamarinPlayStation4, "xamarinpsfour"), new KeyValuePair(FrameworkConstants.FrameworkIdentifiers.XamarinPlayStationVita, "xamarinpsvita"), @@ -339,6 +340,22 @@ public IEnumerable CompatibilityMappings new NuGetFramework(FrameworkConstants.FrameworkIdentifiers.WinRT, FrameworkConstants.EmptyVersion), new NuGetFramework(FrameworkConstants.FrameworkIdentifiers.WinRT, new Version(4, 5, 0, 0)))), + // All XamarinMacNet projects support up to Net45 + new OneWayCompatibilityMappingEntry(new FrameworkRange( + new NuGetFramework(FrameworkConstants.FrameworkIdentifiers.XamarinMacNet, FrameworkConstants.EmptyVersion), + new NuGetFramework(FrameworkConstants.FrameworkIdentifiers.XamarinMacNet, FrameworkConstants.MaxVersion)), + new FrameworkRange( + new NuGetFramework(FrameworkConstants.FrameworkIdentifiers.Net, FrameworkConstants.EmptyVersion), + FrameworkConstants.CommonFrameworks.Net45)), + + // All XamarinMacNet projects support all XamarinMac2 + new OneWayCompatibilityMappingEntry(new FrameworkRange( + new NuGetFramework(FrameworkConstants.FrameworkIdentifiers.XamarinMacNet, FrameworkConstants.EmptyVersion), + new NuGetFramework(FrameworkConstants.FrameworkIdentifiers.XamarinMacNet, FrameworkConstants.MaxVersion)), + new FrameworkRange( + new NuGetFramework(FrameworkConstants.FrameworkIdentifiers.XamarinMac, FrameworkConstants.EmptyVersion), + new NuGetFramework(FrameworkConstants.FrameworkIdentifiers.XamarinMac, new Version(2, 0, 0, 0)))), + // Tizen3 projects support NETStandard1.6 CreateStandardMapping( FrameworkConstants.CommonFrameworks.Tizen3, @@ -469,6 +486,11 @@ public IEnumerable CompatibilityMappings FrameworkConstants.CommonFrameworks.DotNet56, FrameworkConstants.CommonFrameworks.NetStandard20), + CreateGenerationAndStandardMappingForAllVersions( + FrameworkConstants.FrameworkIdentifiers.XamarinMacNet, + FrameworkConstants.CommonFrameworks.DotNet56, + FrameworkConstants.CommonFrameworks.NetStandard16), + CreateGenerationAndStandardMappingForAllVersions( FrameworkConstants.FrameworkIdentifiers.XamarinPlayStation3, FrameworkConstants.CommonFrameworks.DotNet56, @@ -565,6 +587,7 @@ public IEnumerable NonPackageBasedFrameworkPrecedence { _nonPackageBasedFrameworkPrecedence = new[] { + FrameworkConstants.FrameworkIdentifiers.XamarinMac, // For XamarinMacNet, prefer XamarinMac over Net FrameworkConstants.FrameworkIdentifiers.Net, FrameworkConstants.FrameworkIdentifiers.NetCore, FrameworkConstants.FrameworkIdentifiers.Windows, diff --git a/src/NuGet.Core/NuGet.Frameworks/FrameworkConstants.cs b/src/NuGet.Core/NuGet.Frameworks/FrameworkConstants.cs index 6e1718d6a21..2d42ef04fcc 100644 --- a/src/NuGet.Core/NuGet.Frameworks/FrameworkConstants.cs +++ b/src/NuGet.Core/NuGet.Frameworks/FrameworkConstants.cs @@ -59,6 +59,7 @@ public static class FrameworkIdentifiers public const string MonoMac = "MonoMac"; public const string XamarinIOs = "Xamarin.iOS"; public const string XamarinMac = "Xamarin.Mac"; + public const string XamarinMacNet = "Xamarin.Mac.NET"; public const string XamarinPlayStation3 = "Xamarin.PlayStation3"; public const string XamarinPlayStation4 = "Xamarin.PlayStation4"; public const string XamarinPlayStationVita = "Xamarin.PlayStationVita"; diff --git a/test/NuGet.Core.Tests/NuGet.Frameworks.Test/CompatibilityListProviderTests.cs b/test/NuGet.Core.Tests/NuGet.Frameworks.Test/CompatibilityListProviderTests.cs index 41c279b11e9..bdce8261221 100644 --- a/test/NuGet.Core.Tests/NuGet.Frameworks.Test/CompatibilityListProviderTests.cs +++ b/test/NuGet.Core.Tests/NuGet.Frameworks.Test/CompatibilityListProviderTests.cs @@ -40,6 +40,7 @@ public void CompatibilityListProvider_NetStandard12Supporting() Assert.Contains("WindowsPhoneApp,Version=v8.1", actual); Assert.Contains("Xamarin.iOS,Version=v0.0", actual); Assert.Contains("Xamarin.Mac,Version=v0.0", actual); + Assert.Contains("Xamarin.Mac.NET,Version=v0.0", actual); Assert.Contains("Xamarin.PlayStation3,Version=v0.0", actual); Assert.Contains("Xamarin.PlayStation4,Version=v0.0", actual); Assert.Contains("Xamarin.PlayStationVita,Version=v0.0", actual); @@ -83,6 +84,7 @@ public void CompatibilityListProvider_NetStandard15Supporting() Assert.Contains("MonoTouch,Version=v0.0", actual); Assert.Contains("Xamarin.iOS,Version=v0.0", actual); Assert.Contains("Xamarin.Mac,Version=v0.0", actual); + Assert.Contains("Xamarin.Mac.NET,Version=v0.0", actual); Assert.Contains("Xamarin.PlayStation3,Version=v0.0", actual); Assert.Contains("Xamarin.PlayStation4,Version=v0.0", actual); Assert.Contains("Xamarin.PlayStationVita,Version=v0.0", actual); @@ -210,6 +212,7 @@ public void CompatibilityListProvider_NetStandard20Supporting() Assert.Contains("MonoTouch,Version=v0.0", actual); Assert.Contains("Xamarin.iOS,Version=v0.0", actual); Assert.Contains("Xamarin.Mac,Version=v0.0", actual); + Assert.Contains("Xamarin.Mac.NET,Version=v0.0", actual); Assert.Contains("Xamarin.PlayStation3,Version=v0.0", actual); Assert.Contains("Xamarin.PlayStation4,Version=v0.0", actual); Assert.Contains("Xamarin.PlayStationVita,Version=v0.0", actual); @@ -225,7 +228,7 @@ public void CompatibilityListProvider_NetStandard20Supporting() Assert.DoesNotContain("DNXCore,Version=v5.0", actual); // count - Assert.Equal(17, actual.Length); + Assert.Equal(18, actual.Length); } } } diff --git a/test/NuGet.Core.Tests/NuGet.Frameworks.Test/CompatibilityTests.cs b/test/NuGet.Core.Tests/NuGet.Frameworks.Test/CompatibilityTests.cs index cd83f6e732b..135c8e47685 100644 --- a/test/NuGet.Core.Tests/NuGet.Frameworks.Test/CompatibilityTests.cs +++ b/test/NuGet.Core.Tests/NuGet.Frameworks.Test/CompatibilityTests.cs @@ -29,6 +29,45 @@ public class CompatibilityTests [InlineData("dnxcore50", "dotnet5.2", true)] [InlineData("dnxcore50", "dotnet5.1", true)] + // xamarinmacnet45 -> net, xamarinmac, netstandard, dotnet + [InlineData("xamarinmacnet45", "xamarinmacnet", true)] + [InlineData("xamarinmacnet45", "net46", false)] + [InlineData("xamarinmacnet45", "net452", false)] + [InlineData("xamarinmacnet45", "net451", false)] + [InlineData("xamarinmacnet45", "net45", true)] + [InlineData("xamarinmacnet45", "net4", true)] + [InlineData("xamarinmacnet45", "net2", true)] + [InlineData("xamarinmacnet45", "xamarinmac3", false)] + [InlineData("xamarinmacnet45", "xamarinmac2", true)] + [InlineData("xamarinmacnet45", "xamarinmac1", true)] + [InlineData("xamarinmacnet45", "xamarinmac", true)] + [InlineData("xamarinmacnet45", "netstandard1.7", false)] + [InlineData("xamarinmacnet45", "netstandard1.6", true)] + [InlineData("xamarinmacnet45", "netstandard1.5", true)] + [InlineData("xamarinmacnet45", "netstandard1.4", true)] + [InlineData("xamarinmacnet45", "netstandard1.3", true)] + [InlineData("xamarinmacnet45", "netstandard1.2", true)] + [InlineData("xamarinmacnet45", "netstandard1.1", true)] + [InlineData("xamarinmacnet45", "netstandard1.0", true)] + [InlineData("xamarinmacnet45", "dotnet5.7", false)] + [InlineData("xamarinmacnet45", "dotnet5.6", true)] + [InlineData("xamarinmacnet45", "dotnet5.5", true)] + [InlineData("xamarinmacnet45", "dotnet5.4", true)] + [InlineData("xamarinmacnet45", "dotnet5.3", true)] + [InlineData("xamarinmacnet45", "dotnet5.2", true)] + [InlineData("xamarinmacnet45", "dotnet5.1", true)] + [InlineData("xamarinmacnet45", "portable-win8+net45", true)] + [InlineData("xamarinmacnet45", "dnx45", false)] + [InlineData("xamarinmacnet45", "netstandardapp10", false)] + [InlineData("xamarinmacnet45", "netcoreapp10", false)] + [InlineData("xamarinmacnet45", "win8", false)] + [InlineData("xamarinmacnet45", "uap10.0", false)] + [InlineData("xamarinmacnet45", "sl7", false)] + [InlineData("xamarinmacnet45", "wpa", false)] + [InlineData("xamarinmacnet", "netstandard1.6", true)] + [InlineData("xamarinmacnet", "net45", true)] + [InlineData("xamarinmacnet", "xamarinmac2", true)] + // net -> dotnet, netstandard (but not netstandardapp or netcoreapp) [InlineData("net463", "netstandardapp1.6", false)] [InlineData("net463", "netstandardapp1.5", false)] diff --git a/test/NuGet.Core.Tests/NuGet.Frameworks.Test/FrameworkReducerTests.cs b/test/NuGet.Core.Tests/NuGet.Frameworks.Test/FrameworkReducerTests.cs index 052898d5c74..66ba6acdf84 100644 --- a/test/NuGet.Core.Tests/NuGet.Frameworks.Test/FrameworkReducerTests.cs +++ b/test/NuGet.Core.Tests/NuGet.Frameworks.Test/FrameworkReducerTests.cs @@ -90,6 +90,20 @@ public class FrameworkReducerTests [InlineData("portable-net45+netcore45", "portable-net45+netcore45+wpa81,netstandard1.0", "portable-net45+netcore45+wpa81")] [InlineData("portable-net45+netcore45", "netstandard1.1,dotnet5.1", "netstandard1.1")] [InlineData("portable-net45+netcore45+bad", "netstandard1.0", null)] + // XamarinMacNet + [InlineData("xamarinmacnet45", "xamarinmacnet45,xamarinmac2,net45,netstandard1.0,portable-net45+win8,win8", "xamarinmacnet45")] + [InlineData("xamarinmacnet45", "xamarinmacnet40,xamarinmac2,net45,netstandard1.0,portable-net45+win8,win8", "xamarinmacnet40")] + [InlineData("xamarinmacnet45", "xamarinmac2,net45,netstandard1.0,portable-net45+win8,win8", "xamarinmac2")] + [InlineData("xamarinmacnet45", "xamarinmac1,net45,netstandard1.0,portable-net45+win8,win8", "xamarinmac1")] + [InlineData("xamarinmacnet45", "net45,netstandard1.0,portable-net45+win8,win8", "net45")] + [InlineData("xamarinmacnet45", "net40,netstandard1.0,portable-net45+win8,win8", "net40")] + [InlineData("xamarinmacnet45", "portable-net45+win8,win8", "portable-net45+win8")] + [InlineData("xamarinmacnet45", "portable-net40+win8,win8", "portable-net40+win8")] + [InlineData("xamarinmacnet45", "netstandard1.5,win8", "netstandard1.5")] + [InlineData("xamarinmacnet45", "netstandard1.4,win8", "netstandard1.4")] + [InlineData("xamarinmacnet45", "netstandard1.7,net46,win8", null)] + [InlineData("xamarinmacnet45", "net46,win8", null)] + [InlineData("xamarinmacnet45", "win8", null)] // Additional tests [InlineData("dotnet5.5", "dotnet6.0,dotnet5.4,portable-net45+win8", "dotnet5.4")] [InlineData("dotnet7", "dotnet6.0,dotnet5.4,portable-net45+win8", "dotnet6.0")] diff --git a/test/NuGet.Core.Tests/NuGet.Frameworks.Test/NuGetFrameworkParseTests.cs b/test/NuGet.Core.Tests/NuGet.Frameworks.Test/NuGetFrameworkParseTests.cs index e17c57511bc..3c3afbc913b 100644 --- a/test/NuGet.Core.Tests/NuGet.Frameworks.Test/NuGetFrameworkParseTests.cs +++ b/test/NuGet.Core.Tests/NuGet.Frameworks.Test/NuGetFrameworkParseTests.cs @@ -235,6 +235,7 @@ public void NuGetFramework_ProfileName(string folder, string expected) [InlineData("netcoreapp1.0", ".NETCoreApp,Version=v1.0")] [InlineData("netcoreapp1.5", ".NETCoreApp,Version=v1.5")] [InlineData("netcoreapp2.0", ".NetCoreApp,Version=v2.0")] + [InlineData("xamarinmacnet45", "Xamarin.Mac.NET,Version=v4.5")] public void NuGetFramework_ParseToShortName(string expected, string fullName) { // Arrange @@ -283,6 +284,7 @@ public void NuGetFramework_ParseToShortName(string expected, string fullName) [InlineData("netcoreapp1", ".NETCoreApp,Version=v1.0")] [InlineData("netcoreapp1.5", ".NETCoreApp,Version=v1.5")] [InlineData("netcoreapp2", ".NETCoreApp,Version=v2.0")] + [InlineData("xamarinmacnet45", "Xamarin.Mac.NET,Version=v4.5")] public void NuGetFramework_Basic(string folderName, string fullName) { string output = NuGetFramework.Parse(folderName).DotNetFrameworkName; From d6a5c4be56515d7f201f44e24683f0faf942661f Mon Sep 17 00:00:00 2001 From: Joel Verhagen Date: Thu, 2 Mar 2017 12:57:32 -0800 Subject: [PATCH 2/3] Rebase and react to change since 10 long months ago --- .../DefaultFrameworkMappings.cs | 2 +- .../CompatibilityListProviderTests.cs | 11 ++- .../CompatibilityTests.cs | 76 ++++++++++--------- .../FrameworkReducerTests.cs | 28 ++++--- 4 files changed, 65 insertions(+), 52 deletions(-) diff --git a/src/NuGet.Core/NuGet.Frameworks/DefaultFrameworkMappings.cs b/src/NuGet.Core/NuGet.Frameworks/DefaultFrameworkMappings.cs index 06402678bba..905409b60b0 100644 --- a/src/NuGet.Core/NuGet.Frameworks/DefaultFrameworkMappings.cs +++ b/src/NuGet.Core/NuGet.Frameworks/DefaultFrameworkMappings.cs @@ -489,7 +489,7 @@ public IEnumerable CompatibilityMappings CreateGenerationAndStandardMappingForAllVersions( FrameworkConstants.FrameworkIdentifiers.XamarinMacNet, FrameworkConstants.CommonFrameworks.DotNet56, - FrameworkConstants.CommonFrameworks.NetStandard16), + FrameworkConstants.CommonFrameworks.NetStandard20), CreateGenerationAndStandardMappingForAllVersions( FrameworkConstants.FrameworkIdentifiers.XamarinPlayStation3, diff --git a/test/NuGet.Core.Tests/NuGet.Frameworks.Test/CompatibilityListProviderTests.cs b/test/NuGet.Core.Tests/NuGet.Frameworks.Test/CompatibilityListProviderTests.cs index bdce8261221..fbd1ecb918a 100644 --- a/test/NuGet.Core.Tests/NuGet.Frameworks.Test/CompatibilityListProviderTests.cs +++ b/test/NuGet.Core.Tests/NuGet.Frameworks.Test/CompatibilityListProviderTests.cs @@ -56,7 +56,7 @@ public void CompatibilityListProvider_NetStandard12Supporting() Assert.DoesNotContain(".NETPlatform,Version=v5.3", actual); // frameworks with no relationship are not returned // count - Assert.Equal(26, actual.Length); + Assert.Equal(27, actual.Length); } [Fact] @@ -100,7 +100,7 @@ public void CompatibilityListProvider_NetStandard15Supporting() Assert.DoesNotContain(".NETPlatform,Version=v5.6", actual); // frameworks with no relationship are not returned // count - Assert.Equal(19, actual.Length); + Assert.Equal(20, actual.Length); } [Fact] @@ -127,6 +127,7 @@ public void CompatibilityListProvider_NetStandard16Supporting() Assert.Contains("MonoTouch,Version=v0.0", actual); Assert.Contains("Xamarin.iOS,Version=v0.0", actual); Assert.Contains("Xamarin.Mac,Version=v0.0", actual); + Assert.Contains("Xamarin.Mac.NET,Version=v0.0", actual); Assert.Contains("Xamarin.PlayStation3,Version=v0.0", actual); Assert.Contains("Xamarin.PlayStation4,Version=v0.0", actual); Assert.Contains("Xamarin.PlayStationVita,Version=v0.0", actual); @@ -143,7 +144,7 @@ public void CompatibilityListProvider_NetStandard16Supporting() Assert.DoesNotContain("DNXCore,Version=v5.0", actual); // count - Assert.Equal(18, actual.Length); + Assert.Equal(19, actual.Length); } [Fact] @@ -170,6 +171,7 @@ public void CompatibilityListProvider_NetStandard17Supporting() Assert.Contains("MonoTouch,Version=v0.0", actual); Assert.Contains("Xamarin.iOS,Version=v0.0", actual); Assert.Contains("Xamarin.Mac,Version=v0.0", actual); + Assert.Contains("Xamarin.Mac.NET,Version=v0.0", actual); Assert.Contains("Xamarin.PlayStation3,Version=v0.0", actual); Assert.Contains("Xamarin.PlayStation4,Version=v0.0", actual); Assert.Contains("Xamarin.PlayStationVita,Version=v0.0", actual); @@ -186,7 +188,7 @@ public void CompatibilityListProvider_NetStandard17Supporting() Assert.DoesNotContain("DNXCore,Version=v5.0", actual); // count - Assert.Equal(18, actual.Length); + Assert.Equal(19, actual.Length); } [Fact] @@ -206,6 +208,7 @@ public void CompatibilityListProvider_NetStandard20Supporting() Assert.Contains(".NETCoreApp,Version=v2.0", actual); Assert.Contains(".NETFramework,Version=v4.6.1", actual); Assert.Contains(".NETStandard,Version=v2.0", actual); + Assert.Contains(".NETStandardApp,Version=v2.0", actual); Assert.Contains("DNX,Version=v4.6.1", actual); Assert.Contains("MonoAndroid,Version=v0.0", actual); Assert.Contains("MonoMac,Version=v0.0", actual); diff --git a/test/NuGet.Core.Tests/NuGet.Frameworks.Test/CompatibilityTests.cs b/test/NuGet.Core.Tests/NuGet.Frameworks.Test/CompatibilityTests.cs index 135c8e47685..42860884a7c 100644 --- a/test/NuGet.Core.Tests/NuGet.Frameworks.Test/CompatibilityTests.cs +++ b/test/NuGet.Core.Tests/NuGet.Frameworks.Test/CompatibilityTests.cs @@ -29,44 +29,50 @@ public class CompatibilityTests [InlineData("dnxcore50", "dotnet5.2", true)] [InlineData("dnxcore50", "dotnet5.1", true)] - // xamarinmacnet45 -> net, xamarinmac, netstandard, dotnet - [InlineData("xamarinmacnet45", "xamarinmacnet", true)] + // xamarinmacnet -> net, xamarinmac, netstandard, dotnet + [InlineData("xamarinmacnet", "net461", false)] + [InlineData("xamarinmacnet", "net46", false)] + [InlineData("xamarinmacnet", "net452", false)] + [InlineData("xamarinmacnet", "net451", false)] + [InlineData("xamarinmacnet", "net45", true)] + [InlineData("xamarinmacnet", "net4", true)] + [InlineData("xamarinmacnet", "net2", true)] + [InlineData("xamarinmacnet", "xamarinmacnet45", false)] + [InlineData("xamarinmacnet", "xamarinmac3", false)] + [InlineData("xamarinmacnet", "xamarinmac2", true)] + [InlineData("xamarinmacnet", "xamarinmac1", true)] + [InlineData("xamarinmacnet", "xamarinmac", true)] + [InlineData("xamarinmacnet", "netstandard2.1", false)] + [InlineData("xamarinmacnet", "netstandard2.0", true)] + [InlineData("xamarinmacnet", "netstandard1.7", true)] + [InlineData("xamarinmacnet", "netstandard1.6", true)] + [InlineData("xamarinmacnet", "netstandard1.5", true)] + [InlineData("xamarinmacnet", "netstandard1.4", true)] + [InlineData("xamarinmacnet", "netstandard1.3", true)] + [InlineData("xamarinmacnet", "netstandard1.2", true)] + [InlineData("xamarinmacnet", "netstandard1.1", true)] + [InlineData("xamarinmacnet", "netstandard1.0", true)] + [InlineData("xamarinmacnet", "dotnet5.7", false)] + [InlineData("xamarinmacnet", "dotnet5.6", true)] + [InlineData("xamarinmacnet", "dotnet5.5", true)] + [InlineData("xamarinmacnet", "dotnet5.4", true)] + [InlineData("xamarinmacnet", "dotnet5.3", true)] + [InlineData("xamarinmacnet", "dotnet5.2", true)] + [InlineData("xamarinmacnet", "dotnet5.1", true)] + [InlineData("xamarinmacnet", "portable-win8+net45", true)] + [InlineData("xamarinmacnet", "dnx45", false)] + [InlineData("xamarinmacnet", "netstandardapp10", false)] + [InlineData("xamarinmacnet", "netcoreapp10", false)] + [InlineData("xamarinmacnet", "win8", false)] + [InlineData("xamarinmacnet", "uap10.0", false)] + [InlineData("xamarinmacnet", "sl7", false)] + [InlineData("xamarinmacnet", "wpa", false)] + [InlineData("xamarinmacnet45", "netstandard1.6", true)] + [InlineData("xamarinmacnet45", "net461", false)] [InlineData("xamarinmacnet45", "net46", false)] - [InlineData("xamarinmacnet45", "net452", false)] - [InlineData("xamarinmacnet45", "net451", false)] [InlineData("xamarinmacnet45", "net45", true)] - [InlineData("xamarinmacnet45", "net4", true)] - [InlineData("xamarinmacnet45", "net2", true)] - [InlineData("xamarinmacnet45", "xamarinmac3", false)] [InlineData("xamarinmacnet45", "xamarinmac2", true)] - [InlineData("xamarinmacnet45", "xamarinmac1", true)] - [InlineData("xamarinmacnet45", "xamarinmac", true)] - [InlineData("xamarinmacnet45", "netstandard1.7", false)] - [InlineData("xamarinmacnet45", "netstandard1.6", true)] - [InlineData("xamarinmacnet45", "netstandard1.5", true)] - [InlineData("xamarinmacnet45", "netstandard1.4", true)] - [InlineData("xamarinmacnet45", "netstandard1.3", true)] - [InlineData("xamarinmacnet45", "netstandard1.2", true)] - [InlineData("xamarinmacnet45", "netstandard1.1", true)] - [InlineData("xamarinmacnet45", "netstandard1.0", true)] - [InlineData("xamarinmacnet45", "dotnet5.7", false)] - [InlineData("xamarinmacnet45", "dotnet5.6", true)] - [InlineData("xamarinmacnet45", "dotnet5.5", true)] - [InlineData("xamarinmacnet45", "dotnet5.4", true)] - [InlineData("xamarinmacnet45", "dotnet5.3", true)] - [InlineData("xamarinmacnet45", "dotnet5.2", true)] - [InlineData("xamarinmacnet45", "dotnet5.1", true)] - [InlineData("xamarinmacnet45", "portable-win8+net45", true)] - [InlineData("xamarinmacnet45", "dnx45", false)] - [InlineData("xamarinmacnet45", "netstandardapp10", false)] - [InlineData("xamarinmacnet45", "netcoreapp10", false)] - [InlineData("xamarinmacnet45", "win8", false)] - [InlineData("xamarinmacnet45", "uap10.0", false)] - [InlineData("xamarinmacnet45", "sl7", false)] - [InlineData("xamarinmacnet45", "wpa", false)] - [InlineData("xamarinmacnet", "netstandard1.6", true)] - [InlineData("xamarinmacnet", "net45", true)] - [InlineData("xamarinmacnet", "xamarinmac2", true)] + [InlineData("xamarinmacnet45", "xamarinmacnet", true)] // net -> dotnet, netstandard (but not netstandardapp or netcoreapp) [InlineData("net463", "netstandardapp1.6", false)] diff --git a/test/NuGet.Core.Tests/NuGet.Frameworks.Test/FrameworkReducerTests.cs b/test/NuGet.Core.Tests/NuGet.Frameworks.Test/FrameworkReducerTests.cs index 66ba6acdf84..b993963d355 100644 --- a/test/NuGet.Core.Tests/NuGet.Frameworks.Test/FrameworkReducerTests.cs +++ b/test/NuGet.Core.Tests/NuGet.Frameworks.Test/FrameworkReducerTests.cs @@ -91,19 +91,23 @@ public class FrameworkReducerTests [InlineData("portable-net45+netcore45", "netstandard1.1,dotnet5.1", "netstandard1.1")] [InlineData("portable-net45+netcore45+bad", "netstandard1.0", null)] // XamarinMacNet - [InlineData("xamarinmacnet45", "xamarinmacnet45,xamarinmac2,net45,netstandard1.0,portable-net45+win8,win8", "xamarinmacnet45")] + [InlineData("xamarinmacnet", "xamarinmacnet,xamarinmac2,net45,netstandard1.0,portable-net45+win8,win8", "xamarinmacnet")] + [InlineData("xamarinmacnet", "xamarinmacnet45,xamarinmacnet,xamarinmac2,net45,netstandard1.0,portable-net45+win8,win8", "xamarinmacnet")] [InlineData("xamarinmacnet45", "xamarinmacnet40,xamarinmac2,net45,netstandard1.0,portable-net45+win8,win8", "xamarinmacnet40")] - [InlineData("xamarinmacnet45", "xamarinmac2,net45,netstandard1.0,portable-net45+win8,win8", "xamarinmac2")] - [InlineData("xamarinmacnet45", "xamarinmac1,net45,netstandard1.0,portable-net45+win8,win8", "xamarinmac1")] - [InlineData("xamarinmacnet45", "net45,netstandard1.0,portable-net45+win8,win8", "net45")] - [InlineData("xamarinmacnet45", "net40,netstandard1.0,portable-net45+win8,win8", "net40")] - [InlineData("xamarinmacnet45", "portable-net45+win8,win8", "portable-net45+win8")] - [InlineData("xamarinmacnet45", "portable-net40+win8,win8", "portable-net40+win8")] - [InlineData("xamarinmacnet45", "netstandard1.5,win8", "netstandard1.5")] - [InlineData("xamarinmacnet45", "netstandard1.4,win8", "netstandard1.4")] - [InlineData("xamarinmacnet45", "netstandard1.7,net46,win8", null)] - [InlineData("xamarinmacnet45", "net46,win8", null)] - [InlineData("xamarinmacnet45", "win8", null)] + [InlineData("xamarinmacnet45", "xamarinmacnet45,xamarinmac2,net45,netstandard1.0,portable-net45+win8,win8", "xamarinmacnet45")] + [InlineData("xamarinmacnet", "xamarinmac2,net45,netstandard1.0,portable-net45+win8,win8", "xamarinmac2")] + [InlineData("xamarinmacnet", "xamarinmac1,net45,netstandard1.0,portable-net45+win8,win8", "xamarinmac1")] + [InlineData("xamarinmacnet", "net45,netstandard1.0,portable-net45+win8,win8", "net45")] + [InlineData("xamarinmacnet", "net40,netstandard1.0,portable-net45+win8,win8", "net40")] + [InlineData("xamarinmacnet", "portable-net45+win8,win8", "portable-net45+win8")] + [InlineData("xamarinmacnet", "portable-net40+win8,win8", "portable-net40+win8")] + [InlineData("xamarinmacnet", "netstandard1.5,win8", "netstandard1.5")] + [InlineData("xamarinmacnet", "netstandard1.4,win8", "netstandard1.4")] + [InlineData("xamarinmacnet", "netstandard1.7,net46,win8", "netstandard1.7")] + [InlineData("xamarinmacnet", "netstandard2.0,net46,win8", "netstandard2.0")] + [InlineData("xamarinmacnet", "netstandard2.1,net46,win8", null)] + [InlineData("xamarinmacnet", "net46,win8", null)] + [InlineData("xamarinmacnet", "win8", null)] // Additional tests [InlineData("dotnet5.5", "dotnet6.0,dotnet5.4,portable-net45+win8", "dotnet5.4")] [InlineData("dotnet7", "dotnet6.0,dotnet5.4,portable-net45+win8", "dotnet6.0")] From ad9f18676cecee45efce479935360f1b2739c8fd Mon Sep 17 00:00:00 2001 From: Joel Verhagen Date: Thu, 2 Mar 2017 13:00:32 -0800 Subject: [PATCH 3/3] Add some more parsing tests --- .../NuGet.Frameworks.Test/NuGetFrameworkParseTests.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/NuGet.Core.Tests/NuGet.Frameworks.Test/NuGetFrameworkParseTests.cs b/test/NuGet.Core.Tests/NuGet.Frameworks.Test/NuGetFrameworkParseTests.cs index 3c3afbc913b..ddfaa99f979 100644 --- a/test/NuGet.Core.Tests/NuGet.Frameworks.Test/NuGetFrameworkParseTests.cs +++ b/test/NuGet.Core.Tests/NuGet.Frameworks.Test/NuGetFrameworkParseTests.cs @@ -235,6 +235,7 @@ public void NuGetFramework_ProfileName(string folder, string expected) [InlineData("netcoreapp1.0", ".NETCoreApp,Version=v1.0")] [InlineData("netcoreapp1.5", ".NETCoreApp,Version=v1.5")] [InlineData("netcoreapp2.0", ".NetCoreApp,Version=v2.0")] + [InlineData("xamarinmacnet", "Xamarin.Mac.NET,Version=v0.0")] [InlineData("xamarinmacnet45", "Xamarin.Mac.NET,Version=v4.5")] public void NuGetFramework_ParseToShortName(string expected, string fullName) { @@ -284,6 +285,8 @@ public void NuGetFramework_ParseToShortName(string expected, string fullName) [InlineData("netcoreapp1", ".NETCoreApp,Version=v1.0")] [InlineData("netcoreapp1.5", ".NETCoreApp,Version=v1.5")] [InlineData("netcoreapp2", ".NETCoreApp,Version=v2.0")] + [InlineData("xamarinmacnet", "Xamarin.Mac.NET,Version=v0.0")] + [InlineData("xamarinmacnet0", "Xamarin.Mac.NET,Version=v0.0")] [InlineData("xamarinmacnet45", "Xamarin.Mac.NET,Version=v4.5")] public void NuGetFramework_Basic(string folderName, string fullName) {