public void DispatcherExtensions_InvokePassesExceptionsTest() { try { using (var thread1 = new ForegroundThreadWithDispatcher("Test1", System.Threading.ApartmentState.MTA)) { thread1.Dispatcher.Invoke(() => throw new TestException()); } Assert.Fail("We should never get here"); } catch (Exception ex) { Assert.IsInstanceOfType(ex, typeof(TestException)); } }
public void DispatcherExtensions_InvokePassesExceptionsTest() { try { using (var thread1 = new ForegroundThreadWithDispatcher("Test1", System.Threading.ApartmentState.MTA)) { thread1.Dispatcher.Invoke(() => { throw new TestException(); }); } Assert.Fail("We should never get here"); } catch (Exception ex) { Assert.IsInstanceOfType(ex, typeof(TestException)); } }
public void DispatcherExtensions_InvokePassesExceptionsOnSameThreadTest() { try { using (var thread1 = new ForegroundThreadWithDispatcher("Test1")) { var t = thread1; thread1.Dispatcher.Invoke(() => t.Invoke(() => throw new TestException())); } Assert.Fail("We should never get here"); } catch (Exception ex) { Assert.IsInstanceOfType(ex, typeof(TestException)); } }