public void SingleConsumerWithException() { var exec = new StubExecutor(); var one = new PoolFiber(new DefaultThreadPool(), exec); one.Start(); var reset = new AutoResetEvent(false); using (one) { var channel = new QueueChannel <int>(); Action <int> onMsg = delegate(int num) { if (num == 0) { throw new Exception(); } reset.Set(); }; channel.Subscribe(one, onMsg); channel.Publish(0); channel.Publish(1); Assert.IsTrue(reset.WaitOne(10000, false)); Assert.AreEqual(1, exec.failed.Count); } }
public void SingleConsumerWithException() { var exec = new StubExecutor(); var one = new PoolFiber(new DefaultThreadPool(), exec); one.Start(); var reset = new AutoResetEvent(false); using (one) { var channel = new QueueChannel<int>(); Action<int> onMessage = delegate(int num) { if (num == 0) { throw new Exception(); } reset.Set(); }; channel.Subscribe(one, onMessage); channel.Publish(0); channel.Publish(1); Assert.IsTrue(reset.WaitOne(10000, false)); Assert.AreEqual(1, exec.failed.Count); } }