-
-
Notifications
You must be signed in to change notification settings - Fork 361
Unit testing
When you are developing software, you probably want to ensure that you can bend and flex your code and refactor it to your heart's desire without breaking anything.
You probably do that by writing automated tests that test units of your system at various levels.
This page will describe three different levels of testing with Rebus.
Since Rebus can be configured with an in-memory transport and in-memory persistence, you can get away with testing many things by starting a full Rebus instance to participate in your tests without risking tests interfering with each other, or risking that the environment somehow affects the outcome of your tests.
This approach can be very useful to verify that messages flow like you expect them to, since you can easily spin up multiple endpoints that communicate using the in-mem transport - you just need to pass the same Network
instance to them so that they can reach each other - e.g. like so:
var network = new InMemNetwork();
var containerAdapter1 = GetContainerAdapter1();
var containerAdapter2 = GetContainerAdapter2();
using (var bus1 = CreateBus("b1", network, containerAdapter1))
using (var bus2 = CreateBus("b2", network, containerAdapter2))
{
// do stuff in here
}
// further down
public IBus CreateBus(string inputQueueName, InMemNetwork network, IContaineAdapter containerAdapter)
{
return Configure.With(containerAdapter)
.Transport(t => t.UseInMemoryTransport(network, inputQueueName))
.Start();
}
Basic stuff
- Home
- Introduction
- Getting started
- Different bus modes
- How does rebus compare to other .net service buses?
- 3rd party extensions
- Rebus versions
Configuration
Scenarios
Areas
- Logging
- Routing
- Serialization
- Pub sub messaging
- Process managers
- Message context
- Data bus
- Correlation ids
- Container adapters
- Automatic retries and error handling
- Message dispatch
- Thread safety and instance policies
- Timeouts
- Timeout manager
- Transactions
- Delivery guarantees
- Idempotence
- Unit of work
- Workers and parallelism
- Wire level format of messages
- Handler pipeline
- Polymorphic message dispatch
- Persistence ignorance
- Saga parallelism
- Transport message forwarding
- Testing
- Outbox
- Startup/shutdown
Transports (not a full list)
Customization
- Extensibility
- Auto flowing user context extensibility example
- Back off strategy
- Message compression and encryption
- Fail fast on certain exception types
Pipelines
- Log message pipelines
- Incoming messages pipeline
- Incoming step context
- Outgoing messages pipeline
- Outgoing step context
Prominent application services