當前位置: 首頁>>代碼示例>>C#>>正文


C# Chat.SendMessageTo方法代碼示例

本文整理匯總了C#中Chat.SendMessageTo方法的典型用法代碼示例。如果您正苦於以下問題:C# Chat.SendMessageTo方法的具體用法?C# Chat.SendMessageTo怎麽用?C# Chat.SendMessageTo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Chat的用法示例。


在下文中一共展示了Chat.SendMessageTo方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: newUpdatesTest

 public void newUpdatesTest()
 {
     Chat chat = new Chat();
     Assert.IsFalse(chat.newUpdates(1), "Updates for a not existing chatter id");
     Chatter chatter = new Chatter(new Guid(), "chatter");
     chatter.intId = 2;
     chat.join(chatter);
     Assert.IsTrue(chat.newUpdates(chatter.intId), "No updates after joining");
     chat.iAmUpToDate(chatter.intId);
     Assert.IsFalse(chat.newUpdates(chatter.intId), "Updates after call 'I'm up to date'");
     chat.SendMessage("hallo");
     Assert.IsTrue(chat.newUpdates(chatter.intId), "No updates after receiving a new message");
     chat.iAmUpToDate(chatter.intId);
     chat.SendMessageTo("hallo", 1);
     Assert.IsFalse(chat.newUpdates(chatter.intId), "Updates after whispering to a different chatter");
     chat.SendMessageTo("hallo", 2);
     Assert.IsTrue(chat.newUpdates(chatter.intId), "No updates after whispering to this chatter");
 }
開發者ID:Andi1986,項目名稱:ChatApp,代碼行數:18,代碼來源:Chat_offlineTest.cs

示例2: SendMessageToTest1

 public void SendMessageToTest1()
 {
     Chat chat = new Chat();
     for (int i = 0; i < 5; i++)
     {
         string name = "myName" + i;
         string message = "A test message from me for you.." + i;
         int id = i;
         string returnMessage = chat.SendMessageTo(name, message, id);
         Assert.IsTrue(returnMessage.Contains(name), "Run " + i + ": the name was not used");
         Assert.IsTrue(returnMessage.Contains(message), "Run " + i + ": the message text was not used");
         Assert.AreEqual(returnMessage, chat.AllMessages[chat.AllMessages.Count - 1].Message, "Run " + i + ": the saved message is not the returned message");
         Assert.AreEqual(i, chat.AllMessages[chat.AllMessages.Count - 1].id, "Run " + i + ": The message is not for the right id only");
     }
 }
開發者ID:Andi1986,項目名稱:ChatApp,代碼行數:15,代碼來源:Chat_offlineTest.cs


注:本文中的Chat.SendMessageTo方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。