Esempio n. 1
0
        public void TestAllDataPacketStreamShift()
        {
            PacketStream stream = new PacketStream() {
                Data = new byte[] { 0x01, 0x02, 0x03, 0x04 }
            };

            byte[] data = stream.Shift(4);

            Assert.AreEqual(0x01, data[0]);
            Assert.AreEqual(0x02, data[1]);
            Assert.AreEqual(0x03, data[2]);
            Assert.AreEqual(0x04, data[3]);
            Assert.AreEqual(0, stream.Data.Length);
        }
Esempio n. 2
0
        public void TestUninitializedPacketStreamShift()
        {
            PacketStream stream = new PacketStream();

            Assert.IsNull(stream.Shift(1));
        }
Esempio n. 3
0
        public void TestMultiplePacketStreamShiftZeroBytes()
        {
            PacketStream stream = new PacketStream() {
                Data = new byte[] { 0x01, 0x02, 0x03, 0x04 }
            };

            Assert.AreEqual(0, stream.Shift(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]);
        }
Esempio n. 4
0
        public void TestSinglePacketStreamShift()
        {
            PacketStream stream = new PacketStream() {
                Data = new byte[] { 0x01, 0x02, 0x03, 0x04 }
            };

            byte[] data = stream.Shift(1);

            Assert.AreEqual(0x01, data.First());
            Assert.AreEqual(3, stream.Data.Length);
            Assert.AreEqual(0x02, stream.Data[0]);
            Assert.AreEqual(0x03, stream.Data[1]);
            Assert.AreEqual(0x04, stream.Data[2]);
        }
Esempio n. 5
0
        public void TestIndexBoundsPacketStreamShift()
        {
            PacketStream stream = new PacketStream() {
                Data = new byte[] { 0x01, 0x02, 0x03, 0x04 }
            };

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