Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo.moya@xamarin.com>2019-11-28 15:14:19 +0300
committermonojenkins <jo.shields+jenkins@xamarin.com>2020-01-10 18:39:24 +0300
commit5f6ed0bb0d5a9e61227d68826c212099713fab16 (patch)
treec75dff87286aa5c8c5ed05b096f1648546fae0a3 /main/src
parentf6a1cd0b5d04fea9f108486a976db27fc2f8d599 (diff)
[DotNetCore] Add tests for TFM version checks
Diffstat (limited to 'main/src')
-rw-r--r--main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests.csproj1
-rw-r--r--main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests/TargetFrameworkTests.cs76
2 files changed, 77 insertions, 0 deletions
diff --git a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests.csproj b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests.csproj
index d8e14babce..a67d1b6a36 100644
--- a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests.csproj
+++ b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests.csproj
@@ -43,6 +43,7 @@
<Compile Include="MonoDevelop.DotNetCore.Tests\FrameworkReferenceTests.cs" />
<Compile Include="MonoDevelop.DotNetCore.Tests\PackProjectTests.cs" />
<Compile Include="MonoDevelop.DotNetCore.Tests\GlobalToolTests.cs" />
+ <Compile Include="MonoDevelop.DotNetCore.Tests\TargetFrameworkTests.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\external\guiunit\src\framework\GuiUnit_NET_4_5.csproj">
diff --git a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests/TargetFrameworkTests.cs b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests/TargetFrameworkTests.cs
new file mode 100644
index 0000000000..25eec27758
--- /dev/null
+++ b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Tests/MonoDevelop.DotNetCore.Tests/TargetFrameworkTests.cs
@@ -0,0 +1,76 @@
+//
+// TargetFrameworkTests.cs
+//
+// Author:
+// Rodrigo Moya <rodrigo.moya@xamarin.com>
+//
+// Copyright (c) 2019 Microsoft, Corp. (http://www.microsoft.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using MonoDevelop.Core;
+using MonoDevelop.Core.Assemblies;
+using NUnit.Framework;
+
+namespace MonoDevelop.DotNetCore.Tests
+{
+ [TestFixture]
+ class TargetFrameworkTests : DotNetCoreTestBase
+ {
+ [TestCase ("1.0", "1.0", "1.1", "2.0", "2.1", "2.2", "3.0", "3.1")]
+ [TestCase ("1.1", "1.1", "2.0", "2.1", "2.2", "3.0", "3.1")]
+ [TestCase ("2.0", "2.0", "2.1", "2.2", "3.0", "3.1")]
+ [TestCase ("2.1", "2.1", "2.2", "3.0", "3.1")]
+ [TestCase ("2.2", "2.2", "3.0", "3.1")]
+ [TestCase ("3.0", "3.0", "3.1")]
+ public void NetCoreApp_IsVersionOrHigher (string version, params string[] versionsToCheck)
+ {
+ var frameworkVersion = DotNetCoreVersion.Parse (version);
+ foreach (var v in versionsToCheck) {
+ var framework = CreateTargetFramework (".NETCoreApp", v);
+ Assert.True (framework.IsNetCoreAppOrHigher (frameworkVersion));
+ }
+ }
+
+ [TestCase ("1.0", "1.0", "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "2.0", "2.1")]
+ [TestCase ("1.1", "1.1", "1.2", "1.3", "1.4", "1.5", "1.6", "2.0", "2.1")]
+ [TestCase ("1.2", "1.2", "1.3", "1.4", "1.5", "1.6", "2.0", "2.1")]
+ [TestCase ("1.3", "1.3", "1.4", "1.5", "1.6", "2.0", "2.1")]
+ [TestCase ("1.4", "1.4", "1.5", "1.6", "2.0", "2.1")]
+ [TestCase ("1.5", "1.5", "1.6", "2.0", "2.1")]
+ [TestCase ("1.6", "1.6", "2.0", "2.1")]
+ [TestCase ("2.0", "2.0", "2.1")]
+ [TestCase ("2.1", "2.1")]
+ public void NetStandard_IsVersionOrHigher (string version, params string [] versionsToCheck)
+ {
+ var frameworkVersion = DotNetCoreVersion.Parse (version);
+ foreach (var v in versionsToCheck) {
+ var framework = CreateTargetFramework (".NETStandard", v);
+ Assert.True (framework.IsNetStandardOrHigher (frameworkVersion));
+ }
+ }
+
+ static TargetFramework CreateTargetFramework (string identifier, string version)
+ {
+ var moniker = new TargetFrameworkMoniker (identifier, version);
+ return Runtime.SystemAssemblyService.GetTargetFramework (moniker);
+ }
+ }
+}