Skip to content

Make blocking tests async to clear xUnit1031 warnings - #81

Closed
christopherread wants to merge 1 commit into
masterfrom
fix/async-tests-xunit1031
Closed

christopherread wants to merge 1 commit into
masterfrom
fix/async-tests-xunit1031

Conversation

@christopherread

Copy link
Copy Markdown
Owner

Fixes #73.

Changes

xUnit's analyzers flagged 10 places in Obvs.Tests that block on tasks (TestSubjectMessageBus, TestSubjectMessageBusWithScheduler, TestSubjectServiceBus). Each was reported twice, hence the 20 warnings.

  • Tests that called .Wait() are now async Task and await instead. The "blocks until consumed" tests still check the subscriber ran on the calling thread before the first await, so they test the same thing.
  • The four "returns with no observers" tests used .Wait(1). They now assert the returned task IsCompleted. Both buses return already-finished tasks, so this checks the same promise without blocking.

Only test code changes; I didn't write new tests first, because no library behaviour changes.

Testing

  • A full rebuild of Obvs.sln (--no-incremental) gives 0 warnings, 0 errors.
  • All 124 unit tests pass.

🤖 Generated with Claude Code

Tests that waited on publish/send tasks now await them. The "returns
with no observers" tests checked .Wait(1); they now assert the returned
task is already completed, which is what the buses guarantee.

Fixes #73

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@christopherread

Copy link
Copy Markdown
Owner Author

Included in #101, which merged these commits into master (fixes #73).

@christopherread
christopherread deleted the fix/async-tests-xunit1031 branch October 25, 2026 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make blocking tests async to clear xUnit1031 warnings

1 participant