public async Task GroupChatTest() { IGroupChatManager chatManager1 = client1.ChatXmppClient.GetGroupChatManager(groupJid, groupDialogId); chatManager1.JoinGroup(id1.ToString()); IGroupChatManager chatManager2 = client2.ChatXmppClient.GetGroupChatManager(groupJid, groupDialogId); chatManager2.JoinGroup(id2.ToString()); IGroupChatManager chatManager3 = client3.ChatXmppClient.GetGroupChatManager(groupJid, groupDialogId); chatManager3.JoinGroup(id3.ToString()); await Task.Delay(2000); chatManager1.SendMessage("One reports to the group."); await Task.Delay(1000); chatManager2.SendMessage("Three reports to the group"); await Task.Delay(1000); chatManager3.SendMessage("Three reports to the group"); await Task.Delay(1000); Debug.WriteLine("############ Updating name"); string newName = "Name1"; var updateDialogRequest = new UpdateDialogRequest { DialogId = groupDialogId }; updateDialogRequest.Name = newName; var updateDialogResponse = await client2.ChatClient.UpdateDialogAsync(updateDialogRequest); Assert.AreEqual(updateDialogResponse.StatusCode, HttpStatusCode.OK); chatManager2.NotifyGroupNameChanged(newName, DateTime.Now); await Task.Delay(1000); Debug.WriteLine("############ Checking messaging again"); chatManager1.SendMessage("One reports to the group."); await Task.Delay(1000); chatManager2.SendMessage("Three reports to the group"); await Task.Delay(1000); chatManager3.SendMessage("Three reports to the group"); await Task.Delay(1000); await Task.Delay(3000); }
public async Task SendMessageTest() { Message lastClient2Message = null; var createDialogResponse = await client1.ChatClient.CreateDialogAsync("TestDialog1", DialogType.Group, string.Format("{0},{1}", id2, "3125358")); Assert.AreEqual(createDialogResponse.StatusCode, HttpStatusCode.Created); IGroupChatManager chatManager1 = client1.ChatXmppClient.GetGroupChatManager(createDialogResponse.Result.XmppRoomJid, createDialogResponse.Result.Id); IGroupChatManager chatManager2 = client2.ChatXmppClient.GetGroupChatManager(createDialogResponse.Result.XmppRoomJid, createDialogResponse.Result.Id); chatManager1.JoinGroup(id1.ToString()); chatManager2.JoinGroup(id2.ToString()); await Task.Delay(3000); string messageText = "Group test message"; chatManager2.SendMessage(messageText); await Task.Delay(5000); }