public void HandleOkResultTest() { var dispatcher = new CommandDispatcher(_logFactory, "testBC"); var handler = new CommandsResultHandler(); 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 HandleFailResultTest() { var dispatcher = new CommandDispatcher(_logFactory, "testBC"); var handler = new CommandsResultHandler(true, 500); bool ack = false; long retryDelay = 0; dispatcher.Wire(handler); dispatcher.Dispatch("test", (delay, acknowledge) => { retryDelay = delay; ack = acknowledge; }, new Endpoint(), "route"); Assert.That(handler.HandledCommands, Is.EquivalentTo(new object[] { "test" }), "Some commands were not dispatched"); Assert.False(ack, "Command was not acked"); Assert.AreEqual(500, retryDelay); }