From 7b636032b0eecadb90624b233ae3a2ced31efa05 Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Wed, 21 Feb 2018 15:15:41 +0000 Subject: [PATCH] Clean up the ResolveSdksTaskTests a bit --- .../ResolveSdksTaskTests.cs | 69 +++++-------------- 1 file changed, 18 insertions(+), 51 deletions(-) diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/ResolveSdksTaskTests.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/ResolveSdksTaskTests.cs index f3e46b88a62..5df3fd728f0 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/ResolveSdksTaskTests.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/ResolveSdksTaskTests.cs @@ -14,16 +14,19 @@ namespace Xamarin.Android.Build.Tests { [TestFixture] [Parallelizable (ParallelScope.Self)] public class ResolveSdksTaskTests : BaseTest { - #pragma warning disable 414 +#pragma warning disable 414 + + static ApiInfo [] apiInfoSelection = new ApiInfo [] { + new ApiInfo () { Id = "26", Level = 26, Name = "Oreo", FrameworkVersion = "v8.0", Stable = true }, + new ApiInfo () { Id = "27", Level = 27, Name = "Oreo", FrameworkVersion = "v8.1", Stable = true }, + new ApiInfo () { Id = "P", Level = 28, Name = "P", FrameworkVersion = "v8.99", Stable = false }, + }; + static object [] UseLatestAndroidSdkTestCases = new object [] { new object[] { /* buildtools */ "26.0.3", /* jdk */ "1.8.0", - /* apis*/ new ApiInfo[] { - new ApiInfo () { Id = "26", Level = 26, Name = "Oreo", FrameworkVersion = "v8.0", Stable = true }, - new ApiInfo () { Id = "27", Level = 27, Name = "Oreo", FrameworkVersion = "v8.1", Stable = true }, - new ApiInfo () { Id = "P", Level = 28, Name = "P", FrameworkVersion = "v8.99", Stable = false }, - }, + /* apis*/ apiInfoSelection, /* useLatestAndroidSdk */ true, /* targetFrameworkVersion */ "v8.99", /* expectedTaskResult */ true, @@ -34,11 +37,7 @@ public class ResolveSdksTaskTests : BaseTest { new object[] { /* buildtools */ "26.0.3", /* jdk */ "1.8.0", - /* apis*/ new ApiInfo[] { - new ApiInfo () { Id = "26", Level = 26, Name = "Oreo", FrameworkVersion = "v8.0", Stable = true }, - new ApiInfo () { Id = "27", Level = 27, Name = "Oreo", FrameworkVersion = "v8.1", Stable = true }, - new ApiInfo () { Id = "P", Level = 28, Name = "P", FrameworkVersion = "v8.99", Stable = false }, - }, + /* apis*/ apiInfoSelection, /* useLatestAndroidSdk */ true, /* targetFrameworkVersion */ "v8.0", /* expectedTaskResult */ true, @@ -49,11 +48,7 @@ public class ResolveSdksTaskTests : BaseTest { new object[] { /* buildtools */ "26.0.3", /* jdk */ "1.8.0", - /* apis*/ new ApiInfo[] { - new ApiInfo () { Id = "26", Level = 26, Name = "Oreo", FrameworkVersion = "v8.0", Stable = true }, - new ApiInfo () { Id = "27", Level = 27, Name = "Oreo", FrameworkVersion = "v8.1", Stable = true }, - new ApiInfo () { Id = "P", Level = 28, Name = "P", FrameworkVersion = "v8.99", Stable = false }, - }, + /* apis*/ apiInfoSelection, /* useLatestAndroidSdk */ true, /* targetFrameworkVersion */ "v8.1", /* expectedTaskResult */ true, @@ -64,11 +59,7 @@ public class ResolveSdksTaskTests : BaseTest { new object[] { /* buildtools */ "26.0.3", /* jdk */ "1.8.0", - /* apis*/ new ApiInfo[] { - new ApiInfo () { Id = "26", Level = 26, Name = "Oreo", FrameworkVersion = "v8.0", Stable = true }, - new ApiInfo () { Id = "27", Level = 27, Name = "Oreo", FrameworkVersion = "v8.1", Stable = true }, - new ApiInfo () { Id = "P", Level = 28, Name = "P", FrameworkVersion = "v8.99", Stable = false }, - }, + /* apis*/ apiInfoSelection, /* useLatestAndroidSdk */ true, /* targetFrameworkVersion */ "v6.0", /* expectedTaskResult */ true, @@ -79,11 +70,7 @@ public class ResolveSdksTaskTests : BaseTest { new object[] { /* buildtools */ "26.0.3", /* jdk */ "1.8.0", - /* apis*/ new ApiInfo[] { - new ApiInfo () { Id = "26", Level = 26, Name = "Oreo", FrameworkVersion = "v8.0", Stable = true }, - new ApiInfo () { Id = "27", Level = 27, Name = "Oreo", FrameworkVersion = "v8.1", Stable = true }, - new ApiInfo () { Id = "P", Level = 28, Name = "P", FrameworkVersion = "v8.99", Stable = false }, - }, + /* apis*/ apiInfoSelection, /* useLatestAndroidSdk */ true, /* targetFrameworkVersion */ null, /* expectedTaskResult */ true, @@ -94,11 +81,7 @@ public class ResolveSdksTaskTests : BaseTest { new object[] { /* buildtools */ "26.0.3", /* jdk */ "1.8.0", - /* apis*/ new ApiInfo[] { - new ApiInfo () { Id = "26", Level = 26, Name = "Oreo", FrameworkVersion = "v8.0", Stable = true }, - new ApiInfo () { Id = "27", Level = 27, Name = "Oreo", FrameworkVersion = "v8.1", Stable = true }, - new ApiInfo () { Id = "P", Level = 28, Name = "P", FrameworkVersion = "v8.99", Stable = false }, - }, + /* apis*/ apiInfoSelection, /* useLatestAndroidSdk */ false, /* targetFrameworkVersion */ "v8.99", /* expectedTaskResult */ true, @@ -109,11 +92,7 @@ public class ResolveSdksTaskTests : BaseTest { new object[] { /* buildtools */ "26.0.3", /* jdk */ "1.8.0", - /* apis*/ new ApiInfo[] { - new ApiInfo () { Id = "26", Level = 26, Name = "Oreo", FrameworkVersion = "v8.0", Stable = true }, - new ApiInfo () { Id = "27", Level = 27, Name = "Oreo", FrameworkVersion = "v8.1", Stable = true }, - new ApiInfo () { Id = "P", Level = 28, Name = "P", FrameworkVersion = "v8.99", Stable = false }, - }, + /* apis*/ apiInfoSelection, /* useLatestAndroidSdk */ false, /* targetFrameworkVersion */ "v8.1", /* expectedTaskResult */ true, @@ -124,11 +103,7 @@ public class ResolveSdksTaskTests : BaseTest { new object[] { /* buildtools */ "26.0.3", /* jdk */ "1.8.0", - /* apis*/ new ApiInfo[] { - new ApiInfo () { Id = "26", Level = 26, Name = "Oreo", FrameworkVersion = "v8.0", Stable = true }, - new ApiInfo () { Id = "27", Level = 27, Name = "Oreo", FrameworkVersion = "v8.1", Stable = true }, - new ApiInfo () { Id = "P", Level = 28, Name = "P", FrameworkVersion = "v8.99", Stable = false }, - }, + /* apis*/ apiInfoSelection, /* useLatestAndroidSdk */ false, /* targetFrameworkVersion */ "v8.0", /* expectedTaskResult */ true, @@ -139,11 +114,7 @@ public class ResolveSdksTaskTests : BaseTest { new object[] { /* buildtools */ "26.0.3", /* jdk */ "1.8.0", - /* apis*/ new ApiInfo[] { - new ApiInfo () { Id = "26", Level = 26, Name = "Oreo", FrameworkVersion = "v8.0", Stable = true }, - new ApiInfo () { Id = "27", Level = 27, Name = "Oreo", FrameworkVersion = "v8.1", Stable = true }, - new ApiInfo () { Id = "P", Level = 28, Name = "P", FrameworkVersion = "v8.99", Stable = false }, - }, + /* apis*/ apiInfoSelection, /* useLatestAndroidSdk */ false, /* targetFrameworkVersion */ null, /* expectedTaskResult */ true, @@ -154,11 +125,7 @@ public class ResolveSdksTaskTests : BaseTest { new object[] { /* buildtools */ "26.0.3", /* jdk */ "1.8.0", - /* apis*/ new ApiInfo[] { - new ApiInfo () { Id = "26", Level = 26, Name = "Oreo", FrameworkVersion = "v8.0", Stable = true }, - new ApiInfo () { Id = "27", Level = 27, Name = "Oreo", FrameworkVersion = "v8.1", Stable = true }, - new ApiInfo () { Id = "P", Level = 28, Name = "P", FrameworkVersion = "v8.99", Stable = false }, - }, + /* apis*/ apiInfoSelection, /* useLatestAndroidSdk */ false, /* targetFrameworkVersion */ "v6.0", /* expectedTaskResult */ false,