public void EqualsTest() { ChatUser user = ChatUser.Parse("name#1"); ChatUser user2 = user; ChatUser user3 = ChatUser.Parse("name#1"); Assert.IsTrue(user.Equals(user2)); Assert.IsTrue(user.Equals(user3)); Assert.IsTrue(user == user2); Assert.IsTrue(user != user3); ChatUser[] users = new ChatUser[] { user, user2, user3 }; var t = users.Where(u => u.Equals(user)); Assert.AreEqual(3, t.Count()); }
internal static ProxyChatMessage CreateMessageByUser(ChatMessage message, ChatUser mUser) { ProxyChatMessage result = new ProxyChatMessage(message, mUser.Equals(message.Sender)) { MessageType = MessageType.Default }; bool?isMentionedUser = message.Message.MentionedUsers?.Contains(mUser); if (isMentionedUser != null && (bool)isMentionedUser) { result.MessageType = MessageType.Mention; } return(result); }