瀏覽代碼

Fix how assert is called so we don't crash the dispatcher

Claire Novotny 5 年之前
父節點
當前提交
1c89d0b388

+ 5 - 5
Rx.NET/Source/tests/Tests.System.Reactive/Tests/Concurrency/DispatcherSchedulerTest.cs

@@ -113,13 +113,11 @@ namespace ReactiveTests.Tests
             var id = Thread.CurrentThread.ManagedThreadId;
             var id = Thread.CurrentThread.ManagedThreadId;
             var disp = DispatcherHelpers.EnsureDispatcher();
             var disp = DispatcherHelpers.EnsureDispatcher();
             var evt = new ManualResetEvent(false);
             var evt = new ManualResetEvent(false);
+
+            Exception thrownEx = null;
             disp.UnhandledException += (o, e) =>
             disp.UnhandledException += (o, e) =>
             {
             {
-#if NET45 || NET46
-                Assert.Same(ex, e.Exception); // CHECK
-#else
-                Assert.Same(ex, e.Exception.InnerException); // CHECK
-#endif
+                thrownEx = e.Exception;
                 evt.Set();
                 evt.Set();
                 e.Handled = true;
                 e.Handled = true;
             };
             };
@@ -127,6 +125,8 @@ namespace ReactiveTests.Tests
             sch.Schedule(() => { throw ex; });
             sch.Schedule(() => { throw ex; });
             evt.WaitOne();
             evt.WaitOne();
             disp.InvokeShutdown();
             disp.InvokeShutdown();
+
+            Assert.Same(ex, thrownEx);
         }
         }
 
 
         [Fact]
         [Fact]