public void GenerateSendsClientNameWithChatMessage() { ChatMessage chatMsg = new ChatMessage() { ClientName = "terence", Message = "Test" }; chatLog.Add(chatMsg); serverChatLogView.Generate(1f); stubOutgoingMessageQueue.AssertWasCalled(x => x.AddToReliableQueue(Arg<Item>.Matches(y => y.Type == ItemType.ChatLog && ((List<ChatMessage>)y.Data)[0].ClientName == "terence"))); }
public void CopyConstructorCopiesDeep() { ChatMessage msg1 = new ChatMessage() { ClientName = "terence", Message = "foo" }; ChatMessage copy = new ChatMessage(msg1); msg1.ClientName = "zak"; msg1.Message = "bar"; Assert.AreEqual("terence", copy.ClientName); Assert.AreEqual("foo", copy.Message); }
public ChatMessage(ChatMessage copySource) { ClientName = copySource.ClientName; Message = copySource.Message; }
public void TurnsToStringCorrectly() { ChatMessage chatMsg = new ChatMessage() { ClientName = "me", Message = "my message" }; Assert.AreEqual("[me] my message", chatMsg.ToString()); }