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

github.com/xamarin/Xamarin.PropertyEditing.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.PropertyEditing.Tests/PropertiesViewModelTests.cs')
-rw-r--r--Xamarin.PropertyEditing.Tests/PropertiesViewModelTests.cs22
1 files changed, 7 insertions, 15 deletions
diff --git a/Xamarin.PropertyEditing.Tests/PropertiesViewModelTests.cs b/Xamarin.PropertyEditing.Tests/PropertiesViewModelTests.cs
index a7e98a9..6560aa9 100644
--- a/Xamarin.PropertyEditing.Tests/PropertiesViewModelTests.cs
+++ b/Xamarin.PropertyEditing.Tests/PropertiesViewModelTests.cs
@@ -4,6 +4,7 @@ using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Linq;
using System.Reflection;
+using System.Threading;
using System.Threading.Tasks;
using Moq;
using NUnit.Framework;
@@ -35,28 +36,19 @@ namespace Xamarin.PropertyEditing.Tests
}
}
- private Exception unhandled;
+ private TestContext syncContext;
[SetUp]
- public virtual void Setup ()
+ public void Setup ()
{
- AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;
+ this.syncContext = new TestContext ();
+ SynchronizationContext.SetSynchronizationContext (this.syncContext);
}
[TearDown]
public void TearDown ()
{
- AppDomain.CurrentDomain.UnhandledException -= CurrentDomainOnUnhandledException;
-
- if (this.unhandled != null) {
- var ex = this.unhandled;
- this.unhandled = null;
- Assert.Fail ("Unhandled exception: {0}", ex);
- }
- }
-
- private void CurrentDomainOnUnhandledException (object sender, UnhandledExceptionEventArgs e)
- {
- this.unhandled = e.ExceptionObject as Exception;
+ SynchronizationContext.SetSynchronizationContext (null);
+ this.syncContext.ThrowPendingExceptions ();
}
[Test]