Microsoft.Ccr.Core.DispatcherTest.UnhandledExceptionPort C# (CSharp) Method

UnhandledExceptionPort() private method

private UnhandledExceptionPort ( ) : void
return void
        public void UnhandledExceptionPort()
        {
            using (Dispatcher d = new Dispatcher ()) {
                DispatcherQueue dq = new DispatcherQueue ("foo", d);
                var evt = new AutoResetEvent (false);
                int dispEx = 0;
                int queueEx = 0;
                d.UnhandledException += delegate { ++dispEx; };
                dq.UnhandledException += delegate { ++queueEx; evt.Set (); };

                dq.Enqueue (Arbiter.FromHandler (() => { throw new Exception (); }));

                Assert.IsTrue (evt.WaitOne (2000), "#1");
                Assert.AreEqual (0, dispEx, "#2");
                Assert.AreEqual (1, queueEx, "#3");
            }
        }