Skip to content

Commit 7cc1a4e

Browse files
committed
Assert the AlreadyClosedException Exception
Signed-off-by: Gabriele Santomaggio <[email protected]>
1 parent e70ae37 commit 7cc1a4e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Tests/MultiThreadTests.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// 2.0, and the Mozilla Public License, version 2.0.
33
// Copyright (c) 2007-2023 VMware, Inc.
44

5+
using System;
56
using System.Collections.Generic;
67
using System.Threading;
78
using System.Threading.Tasks;
@@ -104,7 +105,14 @@ public async Task CloseProducersConsumersInMultiThreads()
104105
});
105106
for (var j = 0; j < 10000; j++)
106107
{
107-
await producer.Send(new Message(new byte[3]));
108+
try
109+
{
110+
await producer.Send(new Message(new byte[3]));
111+
}
112+
catch (Exception e)
113+
{
114+
Assert.True(e is AlreadyClosedException);
115+
}
108116
}
109117

110118
SystemUtils.WaitUntil(() => producers.TrueForAll(c => !c.IsOpen()));

0 commit comments

Comments
 (0)