本文整理汇总了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");
}