diff --git a/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/CompileSceneKitAssetsTest.cs b/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/CompileSceneKitAssetsTest.cs
index 1bdf5419fc43..3135712da95e 100644
--- a/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/CompileSceneKitAssetsTest.cs
+++ b/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/CompileSceneKitAssetsTest.cs
@@ -27,7 +27,7 @@ public void Compilation ()
var scenePath = Path.GetFullPath (Path.Combine (appPath, "art.scnassets", "scene.scn"));
var xml = Configuration.ReadPListAsXml (scenePath);
- Assert.That (xml, Is.StringContaining ("art.scnassets/texture.png"), "asset with path");
+ Assert.That (xml, Does.Contain ("art.scnassets/texture.png"), "asset with path");
}
[Test]
diff --git a/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/ReleaseBuild.cs b/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/ReleaseBuild.cs
index c58877d33f3d..d2c2ea6cadaa 100644
--- a/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/ReleaseBuild.cs
+++ b/msbuild/tests/Xamarin.iOS.Tasks.Tests/ProjectsTests/ReleaseBuild.cs
@@ -20,7 +20,7 @@ public void BuildTest ()
BuildProject ("MyReleaseBuild", Platform, "Release");
}
- [Ignore] // requires msbuild instead of xbuild
+ [Ignore ("requires msbuild instead of xbuild")]
[Test]
public void RebuildTest ()
{
diff --git a/msbuild/tests/Xamarin.iOS.Tasks.Tests/TargetTests/TargetTests.cs b/msbuild/tests/Xamarin.iOS.Tasks.Tests/TargetTests/TargetTests.cs
index afa7c0fdbf20..e5f54caaff5a 100644
--- a/msbuild/tests/Xamarin.iOS.Tasks.Tests/TargetTests/TargetTests.cs
+++ b/msbuild/tests/Xamarin.iOS.Tasks.Tests/TargetTests/TargetTests.cs
@@ -575,7 +575,7 @@ public void DetectAppManifest_ExecutableProject_NoPList ()
MonoTouchProjectInstance = MonoTouchProject.CreateProjectInstance ();
RunTarget_WithErrors (MonoTouchProjectInstance, TargetName.DetectAppManifest);
- Assert.IsNullOrEmpty (MonoTouchProjectInstance.GetPropertyValue ("_AppManifest"), "#1");
+ Assert.That (MonoTouchProjectInstance.GetPropertyValue ("_AppManifest"), Is.Null.Or.Empty, "#1");
}
[Test]
@@ -625,7 +625,7 @@ public void DetectAppManifest_ExecutableProject_LogicalNamePList ()
public void DetectAppManifest_LibraryProject ()
{
RunTargetOnInstance (LibraryProjectInstance, TargetName.DetectAppManifest);
- Assert.IsNullOrEmpty (LibraryProjectInstance.GetPropertyValue ("_AppManifest"), "#1");
+ Assert.That (LibraryProjectInstance.GetPropertyValue ("_AppManifest"), Is.Not.Null.Or.Empty, "#1");
}
}
}
diff --git a/msbuild/tests/Xamarin.iOS.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_Core.cs b/msbuild/tests/Xamarin.iOS.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_Core.cs
index ca2a5faa329b..42a71681f269 100644
--- a/msbuild/tests/Xamarin.iOS.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_Core.cs
+++ b/msbuild/tests/Xamarin.iOS.Tasks.Tests/TaskTests/GeneratePlistTaskTests/GeneratePlistTaskTests_Core.cs
@@ -91,7 +91,7 @@ public void MissingDisplayName ()
public virtual void XamarinVersion ()
{
Assert.That (CompiledPlist.ContainsKey ("com.xamarin.ios"), "#1");
- Assert.IsNotNullOrEmpty (CompiledPlist.Get ("com.xamarin.ios").GetString ("Version").Value, "#2");
+ Assert.That (CompiledPlist.Get ("com.xamarin.ios").GetString ("Version").Value, Is.Not.Null.Or.Empty, "#2");
}
#endregion
@@ -100,7 +100,7 @@ public virtual void XamarinVersion ()
public void BuildMachineOSBuild ()
{
Assert.That (CompiledPlist.ContainsKey (ManifestKeys.BuildMachineOSBuild), "#1");
- Assert.IsNotNullOrEmpty (CompiledPlist.Get (ManifestKeys.BuildMachineOSBuild).Value, "#2");
+ Assert.That (CompiledPlist.Get (ManifestKeys.BuildMachineOSBuild).Value, Is.Not.Null.Or.Empty, "#2");
}
[Test]
@@ -134,7 +134,7 @@ public virtual void BundleIdentifier ()
public virtual void BundleInfoDictionaryVersion ()
{
Assert.That (CompiledPlist.ContainsKey (ManifestKeys.CFBundleInfoDictionaryVersion), "#1");
- Assert.IsNotNullOrEmpty (CompiledPlist.Get (ManifestKeys.CFBundleInfoDictionaryVersion).Value, "#2");
+ Assert.That (CompiledPlist.Get (ManifestKeys.CFBundleInfoDictionaryVersion).Value, Is.Not.Null.Or.Empty, "#2");
}
[Test]
@@ -162,7 +162,7 @@ public virtual void BundleSupportedPlatforms ()
public virtual void BundleVersion ()
{
Assert.That (CompiledPlist.ContainsKey (ManifestKeys.CFBundleVersion), "#1");
- Assert.IsNotNullOrEmpty (CompiledPlist.Get (ManifestKeys.CFBundleVersion).Value, "#2");
+ Assert.That (CompiledPlist.Get (ManifestKeys.CFBundleVersion).Value, Is.Not.Null.Or.Empty, "#2");
}
[Test]
@@ -184,14 +184,14 @@ public virtual void VerifyAllDT ()
Assert.That (CompiledPlist.ContainsKey (dtSDKName), "#5");
Assert.That (CompiledPlist.ContainsKey (dtXcode), "#6");
Assert.That (CompiledPlist.ContainsKey (dtXcodeBuild), "#7");
- Assert.IsNotNullOrEmpty (CompiledPlist.Get (dtCompiler).Value, "#8");
- Assert.IsNotNullOrEmpty (CompiledPlist.Get (dtPlatformBuild).Value, "#9");
- Assert.IsNotNullOrEmpty (CompiledPlist.Get (dtSDKBuild).Value, "#10");
- Assert.IsNotNullOrEmpty (CompiledPlist.Get (dtPlatformName).Value, "#11");
- Assert.IsNotNullOrEmpty (CompiledPlist.Get (dtPlatformVersion).Value, "#12");
- Assert.IsNotNullOrEmpty (CompiledPlist.Get (dtSDKName).Value, "#13");
- Assert.IsNotNullOrEmpty (CompiledPlist.Get (dtXcode).Value, "#14");
- Assert.IsNotNullOrEmpty (CompiledPlist.Get (dtXcodeBuild).Value, "#15");
+ Assert.That (CompiledPlist.Get (dtCompiler).Value, Is.Not.Null.Or.Empty, "#8");
+ Assert.That (CompiledPlist.Get (dtPlatformBuild).Value, Is.Not.Null.Or.Empty, "#9");
+ Assert.That (CompiledPlist.Get (dtSDKBuild).Value, Is.Not.Null.Or.Empty, "#10");
+ Assert.That (CompiledPlist.Get (dtPlatformName).Value, Is.Not.Null.Or.Empty, "#11");
+ Assert.That (CompiledPlist.Get (dtPlatformVersion).Value, Is.Not.Null.Or.Empty, "#12");
+ Assert.That (CompiledPlist.Get (dtSDKName).Value, Is.Not.Null.Or.Empty, "#13");
+ Assert.That (CompiledPlist.Get (dtXcode).Value, Is.Not.Null.Or.Empty, "#14");
+ Assert.That (CompiledPlist.Get (dtXcodeBuild).Value, Is.Not.Null.Or.Empty, "#15");
}
[Test]
@@ -205,7 +205,7 @@ public virtual void DeviceFamily ()
public virtual void MinimumOSVersion ()
{
Assert.That (CompiledPlist.ContainsKey (ManifestKeys.MinimumOSVersion), "#1");
- Assert.IsNotNullOrEmpty (CompiledPlist.Get (ManifestKeys.MinimumOSVersion).Value, "#2");
+ Assert.That (CompiledPlist.Get (ManifestKeys.MinimumOSVersion).Value, Is.Not.Null.Or.Empty, "#2");
}
#endregion
}
diff --git a/msbuild/tests/Xamarin.iOS.Tasks.Tests/TaskTests/IBToolTaskTests.cs b/msbuild/tests/Xamarin.iOS.Tasks.Tests/TaskTests/IBToolTaskTests.cs
index 97e066c9cac2..671d13f358d5 100644
--- a/msbuild/tests/Xamarin.iOS.Tasks.Tests/TaskTests/IBToolTaskTests.cs
+++ b/msbuild/tests/Xamarin.iOS.Tasks.Tests/TaskTests/IBToolTaskTests.cs
@@ -74,8 +74,8 @@ public void TestBasicIBToolFunctionality ()
foreach (var bundleResource in ibtool.BundleResources) {
Assert.IsTrue (File.Exists (bundleResource.ItemSpec), "File does not exist: {0}", bundleResource.ItemSpec);
- Assert.IsNotNullOrEmpty (bundleResource.GetMetadata ("LogicalName"), "The 'LogicalName' metadata must be set.");
- Assert.IsNotNullOrEmpty (bundleResource.GetMetadata ("Optimize"), "The 'Optimize' metadata must be set.");
+ Assert.That (bundleResource.GetMetadata ("LogicalName"), Is.Not.Null.Or.Empty, "The 'LogicalName' metadata must be set.");
+ Assert.That (bundleResource.GetMetadata ("Optimize"), Is.Not.Null.Or.Empty, "The 'Optimize' metadata must be set.");
bundleResources.Add (bundleResource.GetMetadata ("LogicalName"));
}
@@ -141,10 +141,10 @@ public void TestAdvancedIBToolFunctionality ()
var tag = bundleResource.GetMetadata ("ResourceTags");
Assert.IsTrue (File.Exists (bundleResource.ItemSpec), "File does not exist: {0}", bundleResource.ItemSpec);
- Assert.IsNotNullOrEmpty (bundleResource.GetMetadata ("LogicalName"), "The 'LogicalName' metadata must be set.");
- Assert.IsNotNullOrEmpty (bundleResource.GetMetadata ("Optimize"), "The 'Optimize' metadata must be set.");
+ Assert.That (bundleResource.GetMetadata ("LogicalName"), Is.Not.Null.Or.Empty, "The 'LogicalName' metadata must be set.");
+ Assert.That (bundleResource.GetMetadata ("Optimize"), Is.Not.Null.Or.Empty, "The 'Optimize' metadata must be set.");
- Assert.IsNotNullOrEmpty (tag, "The 'ResourceTags' metadata should be set.");
+ Assert.That (tag, Is.Not.Null.Or.Empty, "The 'ResourceTags' metadata should be set.");
Assert.IsTrue (bundleName.Contains (".lproj/" + tag + ".storyboardc/"), "BundleResource does not have the proper ResourceTags set: {0}", bundleName);
bundleResources.Add (bundleName);
@@ -233,10 +233,10 @@ static void TestGenericAndDeviceSpecificXibsGeneric (params string[] fileNames)
var tag = bundleResource.GetMetadata ("ResourceTags");
Assert.IsTrue (File.Exists (bundleResource.ItemSpec), "File does not exist: {0}", bundleResource.ItemSpec);
- Assert.IsNotNullOrEmpty (bundleResource.GetMetadata ("LogicalName"), "The 'LogicalName' metadata must be set.");
- Assert.IsNotNullOrEmpty (bundleResource.GetMetadata ("Optimize"), "The 'Optimize' metadata must be set.");
+ Assert.That (bundleResource.GetMetadata ("LogicalName"), Is.Not.Null.Or.Empty, "The 'LogicalName' metadata must be set.");
+ Assert.That (bundleResource.GetMetadata ("Optimize"), Is.Not.Null.Or.Empty, "The 'Optimize' metadata must be set.");
- Assert.IsNotNullOrEmpty (tag, "The 'ResourceTags' metadata should be set.");
+ Assert.That (tag, Is.Not.Null.Or.Empty, "The 'ResourceTags' metadata should be set.");
Assert.AreEqual (Path.Combine (tmp, "ibtool", tag + ".nib", Path.GetFileName (bundleName)), bundleResource.ItemSpec, $"BundleResource {bundleName} is not at the expected location.");
bundleResources.Add (bundleName);
diff --git a/msbuild/tests/Xamarin.iOS.Tasks.Tests/TaskTests/MTouchTaskTests.cs b/msbuild/tests/Xamarin.iOS.Tasks.Tests/TaskTests/MTouchTaskTests.cs
index ad1dadfc2d17..dd71fc5389d5 100644
--- a/msbuild/tests/Xamarin.iOS.Tasks.Tests/TaskTests/MTouchTaskTests.cs
+++ b/msbuild/tests/Xamarin.iOS.Tasks.Tests/TaskTests/MTouchTaskTests.cs
@@ -136,12 +136,12 @@ public void MTouchEnableBitcode (string frameworkIdentifier)
}
[Test]
- [ExpectedException (typeof(InvalidOperationException), ExpectedMessage = "Bitcode is currently not supported on iOS.")]
public void StandardCommandline_WithBitcodeEnabled_iOS ()
{
MTouchEnableBitcode("Xamarin.iOS");
- Task.GenerateCommandLineCommands ();
+ var ex = Assert.Throws (() => Task.GenerateCommandLineCommands (), "Exception");
+ Assert.AreEqual ("Bitcode is currently not supported on iOS.", ex.Message, "Message");
}
[Test]
diff --git a/msbuild/tests/Xamarin.iOS.Tasks.Tests/Xamarin.iOS.Tasks.Tests.csproj b/msbuild/tests/Xamarin.iOS.Tasks.Tests/Xamarin.iOS.Tasks.Tests.csproj
index fcb304966598..905a74239e67 100644
--- a/msbuild/tests/Xamarin.iOS.Tasks.Tests/Xamarin.iOS.Tasks.Tests.csproj
+++ b/msbuild/tests/Xamarin.iOS.Tasks.Tests/Xamarin.iOS.Tasks.Tests.csproj
@@ -35,9 +35,9 @@
-
- ..\..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll
-
+
+
+
@@ -120,7 +120,6 @@
-
PreserveNewest
diff --git a/msbuild/tests/Xamarin.iOS.Tasks.Tests/packages.config b/msbuild/tests/Xamarin.iOS.Tasks.Tests/packages.config
deleted file mode 100644
index f43f6de59d30..000000000000
--- a/msbuild/tests/Xamarin.iOS.Tasks.Tests/packages.config
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/tests/Makefile b/tests/Makefile
index 835ada741c69..db967e003f3f 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -209,7 +209,7 @@ killall:
NUNIT_MSBUILD_DIR=$(TOP)/packages/NUnit.Runners.2.6.4/tools/lib
test-ios-tasks:
$(SYSTEM_XIBUILD) -- $(TOP)/msbuild/Xamarin.MacDev.Tasks.sln
- cd $(NUNIT_MSBUILD_DIR) && $(SYSTEM_XIBUILD) -t -- ../nunit-console.exe ../../../../msbuild/tests/bin/Xamarin.iOS.Tasks.Tests.dll -xml=TestResults_Xamarin.iOS.Tasks.Tests.xml -labels $(TEST_FIXTURE) || touch .failed-stamp
+ cd $(TOP)/msbuild/tests/Xamarin.iOS.Tasks.Tests && $(SYSTEM_XIBUILD) -t -- $(abspath $(TOP)/tools/nunit3-console-3.10.0) $(abspath $(TOP)/msbuild/tests/bin/Xamarin.iOS.Tasks.Tests.dll) "--result=$(abspath $(CURDIR)/TestResults_Xamarin.iOS.Tasks.Tests.xml);format=nunit2" -labels=All $(TEST_FIXTURE) || touch .failed-stamp
@[[ -z "$$BUILD_REPOSITORY" ]] || ( xsltproc $(TOP)/tests/HtmlTransform.xslt $(NUNIT_MSBUILD_DIR)/TestResults_Xamarin.iOS.Tasks.Tests.xml > $(TOP)/tests/index.html && echo "@MonkeyWrench: AddFile: $$PWD/index.html" )
@if test -e $(NUNIT_MSBUILD_DIR)/.failed-stamp; then rm $(NUNIT_MSBUILD_DIR)/.failed-stamp; exit 1; fi
diff --git a/tests/xharness/Jenkins.cs b/tests/xharness/Jenkins.cs
index f6c7f24ee445..d0cf352f94fa 100644
--- a/tests/xharness/Jenkins.cs
+++ b/tests/xharness/Jenkins.cs
@@ -3055,11 +3055,21 @@ public void FindNUnitConsoleExecutable (Log log)
var packages_conf = Path.Combine (Path.GetDirectoryName (TestProject.Path), "packages.config");
var nunit_version = string.Empty;
+ var is_packageref = false;
const string default_nunit_version = "3.9.0";
if (!File.Exists (packages_conf)) {
- nunit_version = default_nunit_version;
- log.WriteLine ("No packages.config found for {0}: assuming nunit version is {1}", TestProject, nunit_version);
+ var xml = new XmlDocument ();
+ xml.LoadWithoutNetworkAccess (TestProject.Path);
+ var packageref = xml.SelectSingleNode ("//*[local-name()='PackageReference' and @Include = 'NUnit.ConsoleRunner']");
+ if (packageref != null) {
+ is_packageref = true;
+ nunit_version = packageref.Attributes ["Version"].InnerText;
+ log.WriteLine ("Found PackageReference in {0} for NUnit.ConsoleRunner {1}", TestProject, nunit_version);
+ } else {
+ nunit_version = default_nunit_version;
+ log.WriteLine ("No packages.config found for {0}: assuming nunit version is {1}", TestProject, nunit_version);
+ }
} else {
using (var str = new StreamReader (packages_conf)) {
using (var reader = System.Xml.XmlReader.Create (str)) {
@@ -3083,8 +3093,13 @@ public void FindNUnitConsoleExecutable (Log log)
log.WriteLine ("Found the NUnit.ConsoleRunner/NUnit.Runners element in {0} for {2}, version is: {1}", packages_conf, nunit_version, TestProject.Path);
}
}
-
- if (nunit_version [0] == '2') {
+
+ if (is_packageref) {
+ TestExecutable = Path.Combine (Harness.RootDirectory, "..", "tools", $"nunit3-console-{nunit_version}");
+ if (!File.Exists (TestExecutable))
+ throw new FileNotFoundException ($"The helper script to execute the unit tests does not exist: {TestExecutable}");
+ WorkingDirectory = Path.GetDirectoryName (TestProject.Path);
+ } else if (nunit_version [0] == '2') {
TestExecutable = Path.Combine (Harness.RootDirectory, "..", "packages", "NUnit.Runners." + nunit_version, "tools", "nunit-console.exe");
WorkingDirectory = Path.Combine (Path.GetDirectoryName (TestExecutable), "lib");
} else {
@@ -3099,7 +3114,7 @@ public void FindNUnitConsoleExecutable (Log log)
public bool IsNUnit3 {
get {
- return Path.GetFileName (TestExecutable) == "nunit3-console.exe";
+ return Path.GetFileName (TestExecutable).Contains ("unit3-console");
}
}
public override IEnumerable AggregatedLogs {
diff --git a/tools/nunit3-console-3.10.0 b/tools/nunit3-console-3.10.0
new file mode 100755
index 000000000000..253fc0954fee
--- /dev/null
+++ b/tools/nunit3-console-3.10.0
@@ -0,0 +1,3 @@
+#!/bin/bash -eu
+
+exec mono ~/.nuget/packages/nunit.consolerunner/3.10.0/tools/nunit3-console.exe "$@"