Beispiel #1
0
        public void TestUninitializedPacketStreamPeekShift()
        {
            PacketStream stream = new PacketStream();

            Assert.IsNull(stream.PeekShift(1));
        }
Beispiel #2
0
        public void TestMultiplePacketStreamPeekShiftZeroBytes()
        {
            PacketStream stream = new PacketStream() {
                Data = new byte[] { 0x01, 0x02, 0x03, 0x04 }
            };

            Assert.AreEqual(0, stream.PeekShift(0).Length);
            Assert.AreEqual(4, stream.Data.Length);
            Assert.AreEqual(0x01, stream.Data[0]);
            Assert.AreEqual(0x02, stream.Data[1]);
            Assert.AreEqual(0x03, stream.Data[2]);
            Assert.AreEqual(0x04, stream.Data[3]);
        }
Beispiel #3
0
        public void TestSinglePacketStreamPeekShift()
        {
            PacketStream stream = new PacketStream() {
                Data = new byte[] {0x01, 0x02, 0x03, 0x04}
            };

            Assert.AreEqual(0x01, stream.PeekShift(1).First());
            Assert.AreEqual(4, stream.Data.Length);
            Assert.AreEqual(0x01, stream.Data[0]);
            Assert.AreEqual(0x02, stream.Data[1]);
            Assert.AreEqual(0x03, stream.Data[2]);
            Assert.AreEqual(0x04, stream.Data[3]);
        }
Beispiel #4
0
        public void TestIndexBoundsPacketStreamPeekShift()
        {
            PacketStream stream = new PacketStream() {
                Data = new byte[] { 0x01, 0x02, 0x03, 0x04 }
            };

            Assert.IsNull(stream.PeekShift(5));
        }