Skip to content

Commit c17c33a

Browse files
author
petrov-e
committed
clean
1 parent c105a17 commit c17c33a

File tree

1 file changed

+4
-21
lines changed

1 file changed

+4
-21
lines changed

projects/Unit/TestFloodPublishing.cs

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,7 @@ public async Task TestMultithreadFloodPublishing()
105105
var tcs = new TaskCompletionSource<bool>();
106106
consumer.Received += (o, a) =>
107107
{
108-
Console.WriteLine("Receiving");
109108
var receivedMessage = Encoding.UTF8.GetString(a.Body.ToArray());
110-
if (!receivedMessage.Equals(message))
111-
{
112-
Debugger.Break();
113-
}
114109
Assert.AreEqual(message, receivedMessage);
115110

116111
var result = Interlocked.Increment(ref receivedCount);
@@ -125,29 +120,17 @@ public async Task TestMultithreadFloodPublishing()
125120

126121
using (var timeoutRegistration = cts.Token.Register(() => tcs.SetCanceled()))
127122
{
128-
StartFlood(m, q.QueueName, bp, sendBody, publishCount);
123+
for (int i = 0; i < publishCount; i++)
124+
{
125+
m.BasicPublish(string.Empty, q.QueueName, bp, sendBody);
126+
}
129127

130-
//var tasks = new List<Task>();
131-
//for (int i = 0; i < threadCount; i++)
132-
//{
133-
// tasks.Add(Task.Run(() => StartFlood(m, q.QueueName, bp, sendBody, publishCount)));
134-
//}
135-
//await Task.WhenAll(tasks);
136128
await tcs.Task;
137129
}
138130
m.BasicCancel(tag);
139131
await tcs.Task;
140132
Assert.AreEqual(threadCount * publishCount, receivedCount);
141133
}
142-
143-
144-
void StartFlood(IModel model, string queue, IBasicProperties properties, byte[] body, int count)
145-
{
146-
for (int i = 0; i < count; i++)
147-
{
148-
model.BasicPublish(string.Empty, queue, properties, body);
149-
}
150-
}
151134
}
152135
}
153136
}

0 commit comments

Comments
 (0)