예제 #1
0
파일: Tests.cs 프로젝트: Anreldion/Task-04
        public void AddMessageTest(string message_in_1, string message_in_2)
        {
            TcpClient tcpClient1 = new TcpClient();
            TcpClient tcpClient2 = new TcpClient();

            // Act
            dictionary.AddMessage(tcpClient1, message_in_1);
            dictionary.AddMessage(tcpClient1, message_in_2);

            dictionary.AddMessage(tcpClient2, message_in_1);
            dictionary.AddMessage(tcpClient2, message_in_2);

            // Assert
            Assert.AreEqual(message_in_1, dictionary[tcpClient1][0]);
            Assert.AreEqual(message_in_2, dictionary[tcpClient2][1]);
        }
예제 #2
0
 /// <summary>
 /// Save message from client
 /// </summary>
 /// <param name="tcpClient">TcpClient</param>
 /// <param name="message">Client message</param>
 public void SaveMessage(TcpClient tcpClient, string message)
 {
     messageDictionary.AddMessage(tcpClient, message);
     NewMassageEvent?.Invoke(Client, message);
 }