public void HandleAsyncResultTest() { var dispatcher = new CommandDispatcher(_logFactory, "testBC"); var handler = new CommandsAsyncResultHandler(false); bool ack = false; dispatcher.Wire(handler); dispatcher.Dispatch("test", (delay, acknowledge) => { ack = acknowledge; }, new Endpoint(), "route"); Assert.That(handler.HandledCommands, Is.EquivalentTo(new object[] { "test" }), "Some commands were not dispatched"); Assert.True(ack, "Command was not acked"); }
public void ExceptionOnHandleAsyncResultTest() { var dispatcher = new CommandDispatcher(_logFactory, "testBC"); var handler = new CommandsAsyncResultHandler(true); bool ack = false; long retryDelay = 0; dispatcher.Wire(handler); dispatcher.Dispatch("test", (delay, acknowledge) => { retryDelay = delay; ack = acknowledge; }, new Endpoint(), "route"); Assert.AreEqual(0, handler.HandledCommands.Count); Assert.False(ack, "Command was not acked"); Assert.AreEqual(CommandDispatcher.FailedCommandRetryDelay, retryDelay); }