Exemplo n.º 1
0
        public void TPKT_ReadStreamTooShort()
        {
            var fullMessage = ProtocolUnitTest.StringToByteArray("0300002902f0803203000000010002001400");
            var m           = new TestStream1BytePerRead(fullMessage);

            Assert.ThrowsException <TPKTInvalidException>(() => TPKT.Read(m));
        }
Exemplo n.º 2
0
        public void TPKT_ReadRestrictedStream()
        {
            var fullMessage = ProtocolUnitTest.StringToByteArray("0300002902f0803203000000010002001400000401ff0400807710000100000103000000033f8ccccd");
            var m           = new TestStream1BytePerRead(fullMessage);
            var t           = TPKT.Read(m);

            Assert.AreEqual(fullMessage.Length, t.Length);
            Assert.AreEqual(fullMessage.Last(), t.Data.Last());
        }
Exemplo n.º 3
0
        public async Task TPKT_ReadRestrictedStreamAsync()
        {
            var fullMessage = ProtocolUnitTest.StringToByteArray("0300002902f0803203000000010002001400000401ff0400807710000100000103000000033f8ccccd");
            var m           = new TestStream1BytePerRead(fullMessage);
            var t           = await TPKT.ReadAsync(m, TestContext.CancellationTokenSource.Token);

            Assert.AreEqual(fullMessage.Length, t.Length);
            Assert.AreEqual(fullMessage.Last(), t.Data.Last());
        }