Repository navigation
v7: Obvs.Testing - in-memory transport and test harness - #109
Merged
Merged
Conversation
UseInMemory() carries a service's messages on an in-memory broker, one per container unless a broker is shared between hosts. Delivery behaves like a real transport: per-service destinations, request/response correlation, and asynchronous, in-order delivery on a scheduler (the task pool by default, or a TestScheduler). ObvsTestHarness starts a host on its own broker and records every message passing through it. Sent, Published, Requested and Replied return as soon as a matching message arrives, including one that already has, and time out with ObvsTestTimeoutException listing the messages seen. Timeouts run on a configurable TimeProvider, so they can be tested with virtual time. ObvsBuilder and ObvsServiceBuilder now expose the IServiceCollection, for transports that register their own services. The scheduler and virtual-time support covers the testing needs raised in #37 by Fernando Almeida. Part of #88. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test filtered with OfType<IOrderMessage>, so it passed even if a command reached both services. It now collects every command the bus receives on a test scheduler and expects exactly one; it fails when destinations ignore the service name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Second v7 increment, part of #88 (design, section 5). Targets
v7.API
Behaviour
In-memory transport (
UseInMemory):TestSchedulerholds messages until it runs.Harness (
ObvsTestHarness):Sent,Published,RequestedandRepliedreturn as soon as a matching message passes through, including one that already has.ObvsTestTimeoutExceptionlisting every message that did pass through.options.TimeProvider, so aFakeTimeProvidertests them without real waiting.Other changes:
ObvsBuilderandObvsServiceBuilderexposeServices(theIServiceCollection) for transports that register their own services.Obvs.Testing, but only onmasterand release tags, never fromv7.The scheduler and virtual-time support covers what #37 (@fernando-almeida) asked for.
Tests (written first)
Obvs.Testing.Tests: 8 for the transport and 11 for the harness, agreed before implementation. All failed withNotImplementedExceptionfirst.Obvs.Testingbuilds and packs fornet472,netstandard2.0andnet10.0.Limitations
ShouldOnlyDeliverMessagesToTheirOwnServicecollects every command the bus receives on a test scheduler and expects exactly one. It fails if a command reaches both services, which I confirmed by temporarily breaking destination naming. An earlier version filtered by message type and would have missed that, so it was tightened in a second commit.🤖 Generated with Claude Code