Esempio n. 1
0
        public void WhenExceptionActionPassed_ThenItShouldBeInvokedOnException()
        {
            var  system = new ActorSystem();
            IBus bus    = null;

            system.Add(new ThrowingHandler(), ctx => { bus = ctx.Bus; });
            Exception ex = null;

            var wait = new ManualResetEventSlim(false);

            system.Start(e =>
            {
                ex = e;
                wait.Set();
            });

            var msg = new Message();

            bus.Publish(ref msg);

            Assert.True(wait.Wait(TimeSpan.FromSeconds(10)));

            ExceptionHelpers.ExceptionOrAggregateWithOne(ex, ThrowingHandler.Exception);
        }