public async Task MessageLooksRightWhenReceived() { using (var activator = new BuiltinHandlerActivator()) { var messageWasReceived = new ManualResetEvent(false); DerivedTaskCommand receivedMessage = null; activator.Handle <DerivedTaskCommand>(async message => { receivedMessage = message; messageWasReceived.Set(); }); Configure.With(activator) .Transport(t => t.UseInMemoryTransport(new InMemNetwork(), "doesn't matter")) .Start(); await activator.Bus.SendLocal(new DerivedTaskCommand { Delays = { TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(4), TimeSpan.FromSeconds(5), } }); messageWasReceived.WaitOrDie(TimeSpan.FromSeconds(3)); Assert.That(receivedMessage, Is.Not.Null); Assert.That(receivedMessage.Delays, Is.EqualTo(new[] { TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(4), TimeSpan.FromSeconds(5), })); } }
public async Task ItWorks() { var command = new DerivedTaskCommand { Delays = { TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(4), TimeSpan.FromSeconds(5), } }; var roundtrippedCommand = await Roundtrip(command); Console.WriteLine($@"{command.ToJson()} => {roundtrippedCommand.ToJson()}"); Assert.That(roundtrippedCommand.ToJson(), Is.EqualTo(command.ToJson())); }