Skip to content

Commit 76ae8dd

Browse files
committed
Test fixup
1 parent 366fb9b commit 76ae8dd

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

projects/Unit/TestFloodPublishing.cs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,14 @@ public void TestUnthrottledFloodPublishing()
7171
};
7272

7373
bool elapsed = false;
74-
var t = new System.Threading.Timer((_obj) => { elapsed = true; }, null, 1000 * 185, -1);
75-
/*
76-
t.Elapsed += (_sender, _args) => { elapsed = true; };
77-
t.AutoReset = false;
78-
t.Start();
79-
*/
80-
while (!elapsed)
74+
using (Timer t = new Timer((_obj) => { elapsed = true; }, null, 1000 * 185, -1))
8175
{
82-
Model.BasicPublish("", "", null, new byte[2048]);
76+
while (!elapsed)
77+
{
78+
Model.BasicPublish("", "", null, new byte[2048]);
79+
}
80+
Assert.IsTrue(Conn.IsOpen);
8381
}
84-
Assert.IsTrue(Conn.IsOpen);
85-
t.Dispose();
8682
}
8783

8884
[Test]
@@ -100,7 +96,7 @@ public async Task TestMultithreadFloodPublishing()
10096
{
10197
QueueDeclareOk q = m.QueueDeclare();
10298
IBasicProperties bp = m.CreateBasicProperties();
103-
99+
104100
var consumer = new EventingBasicConsumer(m);
105101
var tcs = new TaskCompletionSource<bool>();
106102
consumer.Received += (o, a) =>

0 commit comments

Comments
 (0)