Created
June 3, 2011 10:18
-
-
Save PeterLehmann/1006139 to your computer and use it in GitHub Desktop.
bug in nsb tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
bus is in the loop tho all msg it cast to type but can be diff type