Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ dotnet_diagnostic.CA1805.severity = warning
dotnet_diagnostic.RCS1129.severity = none
# Use StringBuilder.Append(char) for single character strings.
dotnet_diagnostic.CA1834.severity = warning
# Prefer IsEmpty over Count when available.
dotnet_diagnostic.CA1836.severity = warning
# Use 'string.Method(char)' instead of 'string.Method(string)' for string with single char.
dotnet_diagnostic.CA1866.severity = warning
# Simplify name.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public async IAsyncEnumerator<object> GetAsyncEnumerator(
{
_wait = new TaskCompletionSource<object>();
}
else if (_queue.Count == 0)
else if (_queue.IsEmpty)
{
await _wait.Task.ConfigureAwait(false);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Mocha/test/Mocha.Tests/Inbox/InboxIntegrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public async Task Inbox_Should_RecordMessage_When_EventReceived()

// assert - handler received the message and inbox recorded it
Assert.True(await recorder.WaitAsync(s_timeout), "Handler did not receive the event within timeout");
await WaitUntilAsync(() => inbox.RecordedEnvelopes.Count >= 1, s_timeout);
await WaitUntilAsync(() => !inbox.RecordedEnvelopes.IsEmpty, s_timeout);
Assert.Single(inbox.RecordedEnvelopes);
}

Expand Down
4 changes: 2 additions & 2 deletions src/Mocha/test/Mocha.Tests/Outbox/OutboxIntegrationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public async Task Outbox_Should_CaptureMessage_When_EventPublished()
await bus.PublishAsync(new OutboxTestEvent { Payload = "capture-me" }, CancellationToken.None);

// assert - message captured by outbox, not delivered to transport
await WaitUntilAsync(() => outbox.Envelopes.Count >= 1, s_timeout);
await WaitUntilAsync(() => !outbox.Envelopes.IsEmpty, s_timeout);
Assert.Single(outbox.Envelopes);
}

Expand Down Expand Up @@ -91,7 +91,7 @@ await bus.PublishAsync(
// assert - only one message captured (the one without skip), the skipped one
// was delivered to handler
Assert.True(await recorder.WaitAsync(s_timeout), "Skipped message should have been delivered to handler");
await WaitUntilAsync(() => outbox.Envelopes.Count >= 1, s_timeout);
await WaitUntilAsync(() => !outbox.Envelopes.IsEmpty, s_timeout);

Assert.Single(outbox.Envelopes);
Assert.Single(recorder.Messages);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public async Task Inbox_Should_DeduplicateMessage_When_SameMessageIdPublishedTwi
// act - publish the first message; handler should process it
await bus.PublishAsync(new InboxEvent { Payload = "first" }, CancellationToken.None);
Assert.True(await recorder.WaitAsync(s_timeout), "Handler did not receive the first event");
await WaitUntilAsync(() => inbox.RecordedEnvelopes.Count >= 1, s_timeout);
await WaitUntilAsync(() => !inbox.RecordedEnvelopes.IsEmpty, s_timeout);

// act - publish a second message with the same MessageId; handler should NOT process it
await bus.PublishAsync(new InboxEvent { Payload = "second" }, CancellationToken.None);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public async Task Inbox_Should_DeduplicateMessage_When_SameMessageIdPublishedTwi

// Wait for the first message to be fully processed and recorded in the inbox
Assert.True(await recorder.WaitAsync(s_timeout), "Handler did not receive the first event within timeout");
await WaitUntilAsync(() => inbox.RecordedEnvelopes.Count >= 1, s_timeout);
await WaitUntilAsync(() => !inbox.RecordedEnvelopes.IsEmpty, s_timeout);

await messageBus.PublishAsync(new InboxEvent { Payload = "second" }, CancellationToken.None);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public async ValueTask DisposeAsync()
if (!_disposed)
{
_disposed = true;
if (_operations.Count > 0)
if (!_operations.IsEmpty)
{
var operations = _operations.Values.ToArray();

Expand Down
Loading