From e33b3026189e438de800e4d228501a9a4ae93448 Mon Sep 17 00:00:00 2001 From: Sebastien Pouliot Date: Tue, 10 Dec 2013 21:48:00 -0500 Subject: [PATCH] [tests] Fix some corlib unit tests to run successfully on iOS --- .../System.Runtime.CompilerServices/TaskAwaiterTest.cs | 4 +++- .../corlib/Test/System.Threading/ExecutionContextTest.cs | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/mcs/class/corlib/Test/System.Runtime.CompilerServices/TaskAwaiterTest.cs b/mcs/class/corlib/Test/System.Runtime.CompilerServices/TaskAwaiterTest.cs index f0f8fa8996ffa..18b2099b8dd5f 100644 --- a/mcs/class/corlib/Test/System.Runtime.CompilerServices/TaskAwaiterTest.cs +++ b/mcs/class/corlib/Test/System.Runtime.CompilerServices/TaskAwaiterTest.cs @@ -180,7 +180,9 @@ public void FinishedTaskOnCompleted () }); mres.Set (); - Assert.IsTrue (mres2.WaitOne (2000), "#2");; + // this will only terminate correctly if the test was not executed from the main thread + // e.g. Touch.Unit defaults to run tests on the main thread and this will return false + Assert.AreEqual (Thread.CurrentThread.IsBackground, mres2.WaitOne (2000), "#2");; } } } diff --git a/mcs/class/corlib/Test/System.Threading/ExecutionContextTest.cs b/mcs/class/corlib/Test/System.Threading/ExecutionContextTest.cs index 3a77d9aba2b70..2fa3d91a04fcd 100644 --- a/mcs/class/corlib/Test/System.Threading/ExecutionContextTest.cs +++ b/mcs/class/corlib/Test/System.Threading/ExecutionContextTest.cs @@ -152,6 +152,7 @@ public void CaptureCallContext () } [Test] + [Category("MobileNotWorking")] public void Capture () { ExecutionContext ec = ExecutionContext.Capture (); @@ -169,6 +170,7 @@ public void Capture () } [Test] + [Category("MobileNotWorking")] public void Copy () { ExecutionContext ec = ExecutionContext.Capture (); @@ -198,6 +200,7 @@ public void Copy_FromThread () } [Test] + [Category("MobileNotWorking")] public void IsFlowSuppressed () { Assert.IsFalse (ExecutionContext.IsFlowSuppressed (), "IsFlowSuppressed-1"); @@ -211,12 +214,14 @@ public void IsFlowSuppressed () [Test] [ExpectedException (typeof (InvalidOperationException))] + [Category("MobileNotWorking")] public void RestoreFlow_None () { ExecutionContext.RestoreFlow (); } [Test] + [Category("MobileNotWorking")] public void RestoreFlow_SuppressFlow () { Assert.IsFalse (ExecutionContext.IsFlowSuppressed (), "IsFlowSuppressed-1"); @@ -237,6 +242,7 @@ public void RestoreFlow_SuppressFlow () [Test] [ExpectedException (typeof (InvalidOperationException))] + [Category("MobileNotWorking")] public void Run_SuppressFlow () { Assert.IsFalse (ExecutionContext.IsFlowSuppressed ()); @@ -251,6 +257,7 @@ public void Run_SuppressFlow () } [Test] + [Category("MobileNotWorking")] public void SuppressFlow () { Assert.IsFalse (ExecutionContext.IsFlowSuppressed (), "IsFlowSuppressed-1"); @@ -264,6 +271,7 @@ public void SuppressFlow () [Test] [ExpectedException (typeof (InvalidOperationException))] + [Category("MobileNotWorking")] public void SuppressFlow_Two_Undo () { Assert.IsFalse (ExecutionContext.IsFlowSuppressed (), "IsFlowSuppressed-1");