Skip to content

Testing Support for Handlers#57

Open
iancooper wants to merge 2 commits intomasterfrom
testing_handlers
Open

Testing Support for Handlers#57
iancooper wants to merge 2 commits intomasterfrom
testing_handlers

Conversation

@iancooper
Copy link
Member

Mostly, you can test a Brighter component like a handler or a mapper by new'ing it up and testing it. But if a handler, or other code, takes an IAmACommandProcessor as a dependency, you have a couple of choices:

  • Create a CommandProcessor against an InternalBus, InMemory* and Simple*Factory components
  • Use a test double for the Command Processor

The former is bettr where you are sending a message, because the InMemory* alternates will drive through your components, and so you will test message mappers etc.

However, it is more work, and more knowledge of how to set up all the Brighter dependencies (it might be worth another PR to fix that). So we provide the SpyCommandProcessor to let you substitute and then interrogate the test double.

@iancooper iancooper self-assigned this Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant