diff --git a/tests/common/Configuration.cs b/tests/common/Configuration.cs index 22266e2138a9..08f3c906fbe2 100644 --- a/tests/common/Configuration.cs +++ b/tests/common/Configuration.cs @@ -313,6 +313,17 @@ public static string RootPath { return path; } } + + public static bool TryGetRootPath (out string rootPath) + { + try { + rootPath = RootPath; + return true; + } catch (Exception e) { + rootPath = null; + return false; + } + } static string TestAssemblyDirectory { get { diff --git a/tests/monotouch-test/ObjCRuntime/RegistrarTest.cs b/tests/monotouch-test/ObjCRuntime/RegistrarTest.cs index 6b85eb16b038..fe33af14fb5e 100644 --- a/tests/monotouch-test/ObjCRuntime/RegistrarTest.cs +++ b/tests/monotouch-test/ObjCRuntime/RegistrarTest.cs @@ -2173,10 +2173,13 @@ public void TestCtors () [Test] public void CustomUserTypeWithDynamicallyLoadedAssembly () { + if (!global::Xamarin.Tests.Configuration.TryGetRootPath (out var rootPath)) + Assert.Ignore ("This test must be executed a source checkout."); + #if NET - var customTypeAssemblyPath = global::System.IO.Path.Combine (global::Xamarin.Tests.Configuration.RootPath, "tests", "test-libraries", "custom-type-assembly", ".libs", "dotnet", "macos", "custom-type-assembly.dll"); + var customTypeAssemblyPath = global::System.IO.Path.Combine (rootPath, "tests", "test-libraries", "custom-type-assembly", ".libs", "dotnet", "macos", "custom-type-assembly.dll"); #else - var customTypeAssemblyPath = global::System.IO.Path.Combine (global::Xamarin.Tests.Configuration.RootPath, "tests", "test-libraries", "custom-type-assembly", ".libs", "macos", "custom-type-assembly.dll"); + var customTypeAssemblyPath = global::System.IO.Path.Combine (rootPath, "tests", "test-libraries", "custom-type-assembly", ".libs", "macos", "custom-type-assembly.dll"); #endif Assert.That (customTypeAssemblyPath, Does.Exist, "existence");