Skip to content

Commit

Permalink
Modify the test to publish messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
nand4011 committed Sep 2, 2023
1 parent 68b1cf3 commit 34180b8
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions tests/Integration/Momento.Sdk.Tests/TopicTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ public async Task PublishAndSubscribe_ByteArray_Succeeds()

Console.WriteLine("subscription created");
// var taskCompletionSourceBool = new TaskCompletionSource<bool>();
var semaphoreSlim = new SemaphoreSlim(0, 1);
// var semaphoreSlim = new SemaphoreSlim(0, 1);
var testTask = Task.Run(async () =>
{
// var messageCount = 0;
var receivedSet = new HashSet<byte[]>();
// taskCompletionSourceBool.SetResult(true);
semaphoreSlim.Release();
// semaphoreSlim.Release();
await Task.Delay(2000);
// await foreach (var message in subscription)
// {
Expand All @@ -132,18 +132,18 @@ public async Task PublishAndSubscribe_ByteArray_Succeeds()
return receivedSet.Count;
}, cts.Token);

// Console.WriteLine("enumerator task started");
// // await taskCompletionSourceBool.Task;
Console.WriteLine("enumerator task started");
// await taskCompletionSourceBool.Task;
// await semaphoreSlim.WaitAsync(cts.Token);
// // await Task.Delay(1000);
//
// foreach (var value in valuesToSend)
// {
// var publishResponse = await topicClient.PublishAsync(cacheName, topicName, value);
// Assert.True(publishResponse is TopicPublishResponse.Success, $"Unexpected response: {publishResponse}");
// await Task.Delay(100);
// }
// Console.WriteLine("messages sent");
// await Task.Delay(1000);

foreach (var value in valuesToSend)
{
var publishResponse = await topicClient.PublishAsync(cacheName, topicName, value);
Assert.True(publishResponse is TopicPublishResponse.Success, $"Unexpected response: {publishResponse}");
await Task.Delay(100);
}
Console.WriteLine("messages sent");

int received = await testTask;
Console.WriteLine("Found " + received);
Expand Down

0 comments on commit 34180b8

Please sign in to comment.