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

            Assert.ThrowsException <TPKTInvalidException>(() => TPKT.Read(m));
        }
Beispiel #2
0
        public async Task TPKT_Read()
        {
            var m = new MemoryStream(StringToByteArray("0300002902f0803203000000010002001400000401ff0400807710000100000103000000033f8ccccd"));
            var t = await TPKT.ReadAsync(m, TestContext.CancellationTokenSource.Token);

            Assert.AreEqual(0x03, t.Version);
            Assert.AreEqual(0x29, t.Length);
        }
Beispiel #3
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());
        }
Beispiel #4
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());
        }
Beispiel #5
0
        public void TPKT_Read()
        {
            var m = new MemoryStream(StringToByteArray("0300002902f0803203000000010002001400000401ff0400807710000100000103000000033f8ccccd"));
            var t = TPKT.Read(m);

            Assert.AreEqual(0x03, t.Version);
            Assert.AreEqual(0x29, t.Length);
            m.Position = 0;
            t          = TPKT.ReadAsync(m).Result;
            Assert.AreEqual(0x03, t.Version);
            Assert.AreEqual(0x29, t.Length);
        }
Beispiel #6
0
 public async Task TPKT_ReadShortAsync()
 {
     var m = new MemoryStream(StringToByteArray("0300002902f0803203000000010002001400000401ff040080"));
     var t = await TPKT.ReadAsync(m, TestContext.CancellationTokenSource.Token);
 }
Beispiel #7
0
 public void TPKT_ReadShort()
 {
     var m = new MemoryStream(StringToByteArray("0300002902f0803203000000010002001400000401ff040080"));
     var t = TPKT.Read(m);
 }
Beispiel #8
0
 public async Task TPKT_ReadShortAsync()
 {
     var m = new MemoryStream(StringToByteArray("0300002902f0803203000000010002001400000401ff040080"));
     var t = await TPKT.ReadAsync(m);
 }
Beispiel #9
0
 public async Task TPKT_ReadShort()
 {
     var m = new MemoryStream(StringToByteArray("0300002902f0803203000000010002001400000401ff040080"));
     var t = await TPKT.ReadAsync(m, CancellationToken.None);
 }