From 34180b847fb7fc89df4962b3bb5851d18078f278 Mon Sep 17 00:00:00 2001 From: Nate Anderson Date: Fri, 1 Sep 2023 17:43:35 -0700 Subject: [PATCH] Modify the test to publish messages. --- .../Momento.Sdk.Tests/TopicTest.cs | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/Integration/Momento.Sdk.Tests/TopicTest.cs b/tests/Integration/Momento.Sdk.Tests/TopicTest.cs index 1c078f45..1611ec2e 100644 --- a/tests/Integration/Momento.Sdk.Tests/TopicTest.cs +++ b/tests/Integration/Momento.Sdk.Tests/TopicTest.cs @@ -108,13 +108,13 @@ public async Task PublishAndSubscribe_ByteArray_Succeeds() Console.WriteLine("subscription created"); // var taskCompletionSourceBool = new TaskCompletionSource(); - var semaphoreSlim = new SemaphoreSlim(0, 1); + // var semaphoreSlim = new SemaphoreSlim(0, 1); var testTask = Task.Run(async () => { // var messageCount = 0; var receivedSet = new HashSet(); // taskCompletionSourceBool.SetResult(true); - semaphoreSlim.Release(); + // semaphoreSlim.Release(); await Task.Delay(2000); // await foreach (var message in subscription) // { @@ -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);