Skip to content

Latest commit

 

History

History

MassTransit

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

nuget

Hypothesist.MassTransit

Use Hypothesist to validate received messages as a MassTransit consumer.

Arrange

var expected = new Message(1234); // <-- records are awesome!
var observer = Observer.For<Message>();
var bus = Bus.Factory
    .CreateUsingRabbitMq(cfg =>
    {
        cfg.ReceiveEndpoint("...", e =>
        {
            e.Consumer(observer.AsConsumer);
        });
    });
await bus.StartAsync();

Act

var endpoint = await bus.GetPublishSendEndpoint<Message>();
await endpoint.Send(message);

Assert

await hypothesis
    .On(observer)
    .Timebox(10.Seconds())
    .Any()
    .Match(expected)
    .Validate();