Skip to content

Instantly share code, notes, and snippets.

@PeterLehmann
Created June 3, 2011 10:18
Show Gist options
  • Save PeterLehmann/1006139 to your computer and use it in GitHub Desktop.
Save PeterLehmann/1006139 to your computer and use it in GitHub Desktop.
bug in nsb tests
[Test]
public void TestMessageCast()
{
var id = Guid.NewGuid();
nsTest.Initialize();
nsTest.Handler<CommandHandler>()
.ExpectSend<CreateBookingCommand>(m => m.ShipmentId == id)
.ExpectSend<CreatedShipmentEvent>(m => m.ShipmentId == id)
.OnMessage<CreateShipmentCommand>(m => m.Id = id);
}
public class CommandHandler : IHandleMessages<CreateShipmentCommand>
{
public IBus Bus { get; set; }
public void Handle(CreateShipmentCommand message)
{
Bus.Send(new CreatedShipmentEvent {ShipmentId = message.Id});
Bus.Send(new CreateBookingCommand {ShipmentId = message.Id});
}
}
public class CreateBookingCommand : IMessage
{
public Guid ShipmentId;
}
public class CreatedShipmentEvent : IMessage
{
public Guid ShipmentId;
}
public class CreateShipmentCommand : IMessage
{
public Guid Id { get; set; }
}
@PeterLehmann
Copy link
Author

bus is in the loop tho all msg it cast to type but can be diff type

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment