Skip to content

Commit 0ee319c

Browse files
Add missing awaits in tests
1 parent 884fcb8 commit 0ee319c

File tree

8 files changed

+35
-35
lines changed

8 files changed

+35
-35
lines changed

c-sharp-chat/PubnubChatApi/PubNubChatApi.Tests/ChannelTests.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public async Task TestLeaveChannel()
119119
Assert.IsNotNull(currentChatUser, "currentChatUser was null");
120120

121121
var channel = TestUtils.AssertOperation(await chat.CreatePublicConversation());
122-
channel.Join();
122+
await channel.Join();
123123

124124
await Task.Delay(3000);
125125

@@ -144,7 +144,7 @@ public async Task TestGetMessagesHistory()
144144
{
145145
TestUtils.AssertOperation(await message.EditMessageText("some_new_text"));
146146
};
147-
channel.Join();
147+
await channel.Join();
148148
await Task.Delay(3500);
149149
TestUtils.AssertOperation(await channel.SendText("wololo"));
150150

@@ -163,7 +163,7 @@ public async Task TestGetMessagesHistory()
163163
public async Task TestGetMemberships()
164164
{
165165
var channel = TestUtils.AssertOperation(await chat.CreatePublicConversation("get_members_test_channel"));
166-
channel.Join();
166+
await channel.Join();
167167
await Task.Delay(3500);
168168
var memberships = TestUtils.AssertOperation(await channel.GetMemberships());
169169
Assert.That(memberships.Memberships.Count, Is.GreaterThanOrEqualTo(1));
@@ -173,7 +173,7 @@ public async Task TestGetMemberships()
173173
public async Task TestStartTyping()
174174
{
175175
var channel = TestUtils.AssertOperation(await chat.CreateDirectConversation(talkUser, "sttc")).CreatedChannel;
176-
channel.Join();
176+
await channel.Join();
177177
await Task.Delay(2500);
178178
channel.SetListeningForTyping(true);
179179

@@ -195,7 +195,7 @@ public async Task TestStartTyping()
195195
public async Task TestStopTyping()
196196
{
197197
var channel = TestUtils.AssertOperation(await chat.CreateDirectConversation(talkUser, "stop_typing_test_channel")).CreatedChannel;
198-
channel.Join();
198+
await channel.Join();
199199
await Task.Delay(2500);
200200
channel.SetListeningForTyping(true);
201201
await Task.Delay(2500);
@@ -220,7 +220,7 @@ public async Task TestStopTyping()
220220
public async Task TestStopTypingFromTimer()
221221
{
222222
var channel = TestUtils.AssertOperation(await chat.CreateDirectConversation(talkUser, "stop_typing_timeout_test_channel")).CreatedChannel;
223-
channel.Join();
223+
await channel.Join();
224224
await Task.Delay(2500);
225225
channel.SetListeningForTyping(true);
226226

@@ -245,7 +245,7 @@ public async Task TestStopTypingFromTimer()
245245
public async Task TestPinMessage()
246246
{
247247
var channel = TestUtils.AssertOperation(await chat.CreatePublicConversation("pin_message_test_channel_37"));
248-
channel.Join();
248+
await channel.Join();
249249
await Task.Delay(3500);
250250

251251
var receivedManualEvent = new ManualResetEvent(false);
@@ -273,7 +273,7 @@ public async Task TestPinMessage()
273273
public async Task TestUnPinMessage()
274274
{
275275
var channel = TestUtils.AssertOperation(await chat.CreatePublicConversation("unpin_message_test_channel"));
276-
channel.Join();
276+
await channel.Join();
277277
await Task.Delay(3500);
278278
var receivedManualEvent = new ManualResetEvent(false);
279279
channel.OnMessageReceived += async message =>
@@ -317,7 +317,7 @@ public async Task TestCreateMessageDraft()
317317
public async Task TestEmitUserMention()
318318
{
319319
var channel = TestUtils.AssertOperation(await chat.CreatePublicConversation("user_mention_test_channel"));
320-
channel.Join();
320+
await channel.Join();
321321
await Task.Delay(2500);
322322
var receivedManualEvent = new ManualResetEvent(false);
323323
user.SetListeningForMentionEvents(true);
@@ -336,7 +336,7 @@ public async Task TestEmitUserMention()
336336
public async Task TestChannelIsPresent()
337337
{
338338
var someChannel = TestUtils.AssertOperation(await chat.CreatePublicConversation());
339-
someChannel.Join();
339+
await someChannel.Join();
340340

341341
await Task.Delay(4000);
342342

@@ -349,7 +349,7 @@ public async Task TestChannelIsPresent()
349349
public async Task TestChannelWhoIsPresent()
350350
{
351351
var someChannel = TestUtils.AssertOperation(await chat.CreatePublicConversation());
352-
someChannel.Join();
352+
await someChannel.Join();
353353

354354
await Task.Delay(4000);
355355

@@ -370,7 +370,7 @@ public async Task TestPresenceCallback()
370370
Assert.True(userIds.Contains(user.Id), "presence callback doesn't contain joined user id");
371371
reset.Set();
372372
};
373-
someChannel.Join();
373+
await someChannel.Join();
374374
var presenceReceived = reset.WaitOne(12000);
375375

376376
Assert.True(presenceReceived, "did not receive presence callback");
@@ -389,7 +389,7 @@ public async Task TestReportCallback()
389389
reset.Set();
390390
};
391391

392-
someChannel.Join();
392+
await someChannel.Join();
393393
await Task.Delay(3000);
394394

395395
someChannel.OnMessageReceived += async message =>

c-sharp-chat/PubnubChatApi/PubNubChatApi.Tests/ChatEventTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public async Task Setup()
2121
}));
2222
channel = TestUtils.AssertOperation(await chat.CreatePublicConversation("event_tests_channel"));
2323
user = TestUtils.AssertOperation(await chat.GetCurrentUser());
24-
channel.Join();
24+
await channel.Join();
2525
await Task.Delay(3500);
2626
}
2727

c-sharp-chat/PubnubChatApi/PubNubChatApi.Tests/ChatTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ public async Task Setup()
2121
}));
2222
channel = TestUtils.AssertOperation(await chat.CreatePublicConversation("chat_tests_channel_2"));
2323
currentUser = TestUtils.AssertOperation(await chat.GetCurrentUser());
24-
channel.Join();
24+
await channel.Join();
2525
await Task.Delay(3500);
2626
}
2727

2828
[TearDown]
2929
public async Task CleanUp()
3030
{
31-
channel.Leave();
31+
await channel.Leave();
3232
await Task.Delay(1000);
3333
chat.Destroy();
3434
await Task.Delay(1000);
@@ -140,7 +140,7 @@ public async Task TestForwardMessage()
140140
Assert.True(message.MessageText == "message_to_forward");
141141
messageForwardReceivedManualEvent.Set();
142142
};
143-
forwardingChannel.Join();
143+
await forwardingChannel.Join();
144144
await Task.Delay(2500);
145145

146146
channel.OnMessageReceived += async message => { await message.Forward(forwardingChannel.Id); };
@@ -192,7 +192,7 @@ public async Task TestGetUnreadMessagesCounts()
192192
public async Task TestMarkAllMessagesAsRead()
193193
{
194194
var markTestChannel = TestUtils.AssertOperation(await chat.CreatePublicConversation());
195-
markTestChannel.Join();
195+
await markTestChannel.Join();
196196

197197
await Task.Delay(3000);
198198

@@ -208,7 +208,7 @@ public async Task TestMarkAllMessagesAsRead()
208208

209209
var counts = TestUtils.AssertOperation(await chat.GetUnreadMessagesCounts());
210210

211-
markTestChannel.Leave();
211+
await markTestChannel.Leave();
212212
await markTestChannel.Delete(false);
213213

214214
Assert.False(counts.Any(x => x.ChannelId == markTestChannel.Id && x.Count > 0));
@@ -224,7 +224,7 @@ public async Task TestReadReceipts()
224224
}));
225225
var otherChatChannel = TestUtils.AssertOperation(await otherChat.GetChannel(channel.Id));
226226

227-
otherChatChannel.Join();
227+
await otherChatChannel.Join();
228228
await Task.Delay(2500);
229229
otherChatChannel.SetListeningForReadReceiptsEvents(true);
230230
await Task.Delay(2500);

c-sharp-chat/PubnubChatApi/PubNubChatApi.Tests/MembershipTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public async Task Setup()
2121
}));
2222
channel = TestUtils.AssertOperation(await chat.CreatePublicConversation("membership_tests_channel"));
2323
user = TestUtils.AssertOperation(await chat.GetCurrentUser());
24-
channel.Join();
24+
await channel.Join();
2525
await Task.Delay(3500);
2626
}
2727

@@ -112,7 +112,7 @@ public async Task TestInviteMultiple()
112112
public async Task TestLastRead()
113113
{
114114
var testChannel = TestUtils.AssertOperation(await chat.CreatePublicConversation("last_read_test_channel_57"));
115-
testChannel.Join();
115+
await testChannel.Join();
116116

117117
await Task.Delay(4000);
118118

@@ -151,7 +151,7 @@ public async Task TestLastRead()
151151
public async Task TestUnreadMessagesCount()
152152
{
153153
var unreadChannel = TestUtils.AssertOperation(await chat.CreatePublicConversation($"test_channel_{Guid.NewGuid()}"));
154-
unreadChannel.Join();
154+
await unreadChannel.Join();
155155

156156
await Task.Delay(3500);
157157

c-sharp-chat/PubnubChatApi/PubNubChatApi.Tests/MessageDraftTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public async Task Setup()
2323
{
2424
Name = "MessageDraftTestingChannel"
2525
}));
26-
channel.Join();
26+
await channel.Join();
2727
await Task.Delay(3000);
2828

2929
dummyUser = await chat.GetOrCreateUser("mock_user", new ChatUserData()

c-sharp-chat/PubnubChatApi/PubNubChatApi.Tests/MessageTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public async Task Setup()
2121
}));
2222
channel = TestUtils.AssertOperation(await chat.CreatePublicConversation("message_tests_channel_2"));
2323
user = TestUtils.AssertOperation(await chat.GetCurrentUser());
24-
channel.Join();
24+
await channel.Join();
2525
await Task.Delay(3500);
2626
}
2727

@@ -205,7 +205,7 @@ public async Task TestRestoreMessage()
205205
public async Task TestPinMessage()
206206
{
207207
var pinTestChannel = TestUtils.AssertOperation(await chat.CreatePublicConversation());
208-
pinTestChannel.Join();
208+
await pinTestChannel.Join();
209209
await Task.Delay(2500);
210210
pinTestChannel.SetListeningForUpdates(true);
211211
await Task.Delay(3000);
@@ -277,7 +277,7 @@ public async Task TestCreateThread()
277277
{
278278
message.SetListeningForUpdates(true);
279279
var thread = TestUtils.AssertOperation(message.CreateThread());
280-
thread.Join();
280+
await thread.Join();
281281
await Task.Delay(3500);
282282
await thread.SendText("thread_init_text");
283283
await Task.Delay(5000);

c-sharp-chat/PubnubChatApi/PubNubChatApi.Tests/ThreadsTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public async Task Setup()
2323
var randomId = Guid.NewGuid().ToString()[..10];
2424
channel = TestUtils.AssertOperation(await chat.CreatePublicConversation(randomId));
2525
user = TestUtils.AssertOperation(await chat.GetCurrentUser());
26-
channel.Join();
26+
await channel.Join();
2727
await Task.Delay(3500);
2828
}
2929

@@ -45,7 +45,7 @@ public async Task TestGetThreadHistory()
4545
{
4646
message.SetListeningForUpdates(true);
4747
var thread = TestUtils.AssertOperation(message.CreateThread());
48-
thread.Join();
48+
await thread.Join();
4949

5050
await Task.Delay(5000);
5151

@@ -72,7 +72,7 @@ public async Task TestThreadChannelParentChannelPinning()
7272
{
7373
message.SetListeningForUpdates(true);
7474
var thread = TestUtils.AssertOperation(message.CreateThread());
75-
thread.Join();
75+
await thread.Join();
7676
await thread.SendText("thread init message");
7777

7878
await Task.Delay(7000);
@@ -105,7 +105,7 @@ public async Task TestThreadChannelEmitUserMention()
105105
channel.OnMessageReceived += async message =>
106106
{
107107
var thread = TestUtils.AssertOperation(message.CreateThread());
108-
thread.Join();
108+
await thread.Join();
109109
await Task.Delay(2500);
110110
user.SetListeningForMentionEvents(true);
111111
await Task.Delay(2500);
@@ -129,7 +129,7 @@ public async Task TestThreadMessageParentChannelPinning()
129129
{
130130
message.SetListeningForUpdates(true);
131131
var thread = TestUtils.AssertOperation(message.CreateThread());
132-
thread.Join();
132+
await thread.Join();
133133

134134
await Task.Delay(3500);
135135

@@ -169,7 +169,7 @@ public async Task TestThreadMessageUpdate()
169169
{
170170
message.SetListeningForUpdates(true);
171171
var thread = TestUtils.AssertOperation(message.CreateThread());
172-
thread.Join();
172+
await thread.Join();
173173

174174
await Task.Delay(3000);
175175

c-sharp-chat/PubnubChatApi/PubNubChatApi.Tests/UserTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public async Task TestSoftDeleteAndRestoreUser()
142142
public async Task TestUserWherePresent()
143143
{
144144
var someChannel = TestUtils.AssertOperation(await chat.CreatePublicConversation());
145-
someChannel.Join();
145+
await someChannel.Join();
146146

147147
await Task.Delay(4000);
148148

@@ -155,7 +155,7 @@ public async Task TestUserWherePresent()
155155
public async Task TestUserIsPresentOn()
156156
{
157157
var someChannel = TestUtils.AssertOperation(await chat.CreatePublicConversation());
158-
someChannel.Join();
158+
await someChannel.Join();
159159

160160
await Task.Delay(4000);
161161

0 commit comments

Comments
 (0)