示例#1
0
        public void TrimmedReceivedDataWhenStartShouldContainReceivedMessage()
        {
            MockSocketCommunication mockSocket = new MockSocketCommunication();

            ChatServerSide server = new ChatServerSide(mockSocket);

            mockSocket.TextToReceive = "testUser<sep>testMessage<sep>lastMessageReceived<eof>";

            server.Start();

            Assert.Equal("testUser<sep>testMessage<sep>lastMessageReceived<eof>", mockSocket.TrimmedReceivedData);
        }
示例#2
0
        public void StartWhenNotNullSocketShouldWaitForIncomingConnection()
        {
            MockSocketCommunication mockSocket = new MockSocketCommunication();

            ChatServerSide server = new ChatServerSide(mockSocket);

            mockSocket.TextToReceive = "testUser<sep>testMessage<sep>lastMessageReceived<eof>";

            server.Start();

            Assert.True(mockSocket.ServerIsWaiting);
        }
示例#3
0
        public void StartWhenNullSocketShouldThrowException()
        {
            ChatServerSide server = new ChatServerSide(null);

            Assert.Throws <ArgumentNullException>(() => server.Start());
        }