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


C# Chat.GetMyMessages方法代碼示例

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


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

示例1: GetMyMessagesTest

        public void GetMyMessagesTest()
        {
            Chat chat = new Chat();
            List<Chat.ChatMessageLine> allMessages = chat.AllMessages;
            Chat.ChatMessageLine messageForAll = new Chat.ChatMessageLine();
            messageForAll.id = -1;
            messageForAll.Message = "This is a message for all chatters";
            Chat.ChatMessageLine privateMessage = new Chat.ChatMessageLine();
            privateMessage.id = 3;
            privateMessage.Message = "This is a message just for you";
            allMessages.Add(messageForAll);
            allMessages.Add(privateMessage);

            Assert.IsTrue(chat.GetMyMessages(3).Contains(messageForAll.Message), "The message for all was not returned");
            Assert.IsTrue(chat.GetMyMessages(3).Contains(privateMessage.Message), "The private message was not returned");
            Assert.IsTrue(chat.GetMyMessages(2).Contains(messageForAll.Message), "The message for all was not returned");
            Assert.IsFalse(chat.GetMyMessages(2).Contains(privateMessage.Message), "The private message was returned to the wrong chatter");
        }
開發者ID:Andi1986,項目名稱:ChatApp,代碼行數:18,代碼來源:Chat_offlineTest.cs


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