Skip to content

Commit 92b3988

Browse files
committed
Unit test cleanup.
1 parent d3dcc04 commit 92b3988

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/kafka-tests/Unit/NagleBlockingCollectionTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public void TakeAsyncShouldPlayNiceWithTPL()
195195

196196
dataTask.ContinueWith(x => exit = true);
197197

198-
Parallel.ForEach(Enumerable.Range(0, max),
198+
Parallel.ForEach(Enumerable.Range(0, max).ToList(),
199199
new ParallelOptions { MaxDegreeOfParallelism = 20 },
200200
async x =>
201201
{
@@ -228,7 +228,7 @@ public void TakeAsyncShouldBeThreadSafe()
228228
take3.ContinueWith(t => Console.WriteLine("Take3 done..."));
229229
Task.WhenAll(take1, take2, take3).ContinueWith(x => exit = true);
230230

231-
Parallel.ForEach(Enumerable.Range(0, max),
231+
Parallel.ForEach(Enumerable.Range(0, max).ToList(),
232232
new ParallelOptions { MaxDegreeOfParallelism = 20 },
233233
async x =>
234234
{

src/kafka-tests/Unit/ProducerTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ public void ProducerShouldReportCorrectAmountOfAsyncRequests()
8484
semaphore.Release();
8585
sendTask.Wait(TimeSpan.FromMilliseconds(500));
8686

87-
Assert.That(producer.AsyncCount, Is.EqualTo(0), "Async should have completed.");
87+
Assert.That(sendTask.IsCompleted, Is.True, "Send task should be marked as completed.");
88+
Assert.That(producer.AsyncCount, Is.EqualTo(0), "Async should now show zero count.");
8889
}
8990
}
9091

0 commit comments

Comments
 (0)