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