Skip to content

Latest commit

 

History

History

ServiceBus

Hypothesist: Azure ServiceBus adapter

Easily test your ServiceBus integration by hooking up your hypothesis test into a service bus processor and receiver.

// Arrange
var observer = new Observer<ServiceBusReceivedMessage>();

await using var client = new ServiceBusClient(..., new DefaultAzureCredential());
await using var processor = await observer.For(client.CreateProcessor(...));

// Act
await sut.Something(); // publish something to servicebus

// Assert
await hypothesis
    .On(observer)
    .Timebox(10.Seconds())
    .Any()
    .Match(m => m.Body.ToString() == "data")
    .Validate();

and for the receiver:

await using var receiver = await observer.For(client.CreateReceiver(...));

See the docs to get a better understanding of what hypothesist is and can do for you.