Exemple #1
0
        public void BigPacketReceiveTesting()
        {
            var whiteBoardData   = NetworkingGlobals.GetRandomString(4000);
            var whiteBoardPacket = new Packet {
                ModuleIdentifier = Modules.WhiteBoard, SerializedData = whiteBoardData
            };
            var message = GetMessage(whiteBoardPacket);
            var msg1    = message;
            var stream  = _clientSocket.GetStream();

            stream.Write(Encoding.ASCII.GetBytes(msg1), 0, msg1.Length);
            stream.Flush();

            while (_queue.IsEmpty())
            {
            }

            var packet = _queue.Dequeue();

            Assert.Multiple(() =>
            {
                Assert.AreEqual(whiteBoardPacket.ModuleIdentifier, packet.ModuleIdentifier);
                Assert.AreEqual(whiteBoardData, packet.SerializedData);
            });
        }
Exemple #2
0
        public static FakeChat GetFakeChat()
        {
            var fakeChat = new FakeChat();

            fakeChat.Message   = NetworkingGlobals.GetRandomString();
            fakeChat.Timestamp = DateTime.Now.ToString();
            return(fakeChat);
        }
Exemple #3
0
        public void BigPacketServerSendTesting()
        {
            var whiteBoardData   = NetworkingGlobals.GetRandomString(1500);
            var whiteBoardPacket = new Packet {
                ModuleIdentifier = Modules.WhiteBoard, SerializedData = whiteBoardData
            };

            _queueS.Enqueue(whiteBoardPacket);

            while (_queueR.IsEmpty())
            {
            }

            var packet = _queueR.Dequeue();

            Assert.Multiple(() =>
            {
                Assert.AreEqual(whiteBoardPacket.ModuleIdentifier, packet.ModuleIdentifier);
                Assert.AreEqual(whiteBoardData, packet.SerializedData);
            });
        }