MyServiceBusDocs

Testing

Test message behavior without a running broker.

The in-memory test harness uses the same lifecycle and observation model in both clients, so application tests can exercise messaging behavior in isolation.

A minimal harness test

C#
Loading code…

What the harness guarantees

  • Explicit start and stop lifecycle
  • Handler and consumer registration before delivery begins
  • Per-delivery dependency-injection scopes for configured consumers
  • Deterministic consumed observations with explicit timeouts
  • Aligned behavior across C# and Java
Harness vs mediator

The test harness models a hosted transport lifecycle. The standalone in-memory mediator is immediately usable after construction and is intended for in-process messaging.

Integration and interoperability tests

For transport-level confidence, the project uses pinned local brokers and emulators. RabbitMQ runs through Testcontainers, Amazon SQS/SNS through LocalStack, and Azure Service Bus through Microsoft's emulator. Cross-language and MassTransit scenarios are transport-specific. Emulators are the default acceptance environments; live cloud is reserved for documented fidelity gaps, observed discrepancies, and cloud-only concerns.

Trust the emulator by default

LocalStack runs bidirectional C#, Java, and MassTransit 8.5.1 send/publication checks. The narrower AWS gate is not a routine duplicate run; use it only when the emulator cannot establish the behavior under test.

Azure evidence is split by fidelity

The Azure emulator runs the same eight bidirectional send/publication directions across C#, Java, and MassTransit 8.5.1. A short-lived live namespace is reserved for releases, management topology, locks, temporary queues, authentication, SDK changes, and suspected emulator discrepancies.

NextSee what compatibility means
Interoperability →