Exemple #1
0
        public void bytebuf_writeread_byte_test()
        {
            IByteBuf buf = new AbstructByteBuf(256);

            buf.SetOffset(1);
            buf.WriteByte((byte)1);

            Assert.AreEqual(buf.Offset, 1);
            Assert.AreEqual(buf.ReadIndex, 1);
            Assert.AreEqual(buf.WriteIndex, 2);
            Assert.AreEqual(buf.Readables(), 1);
            Assert.AreEqual(buf.Writeables(), 254);

            byte b1 = buf.ReadByte();

            Assert.AreEqual(b1, 1);

            Assert.AreEqual(buf.Offset, 1);
            Assert.AreEqual(buf.ReadIndex, 2);
            Assert.AreEqual(buf.WriteIndex, 2);
            Assert.AreEqual(buf.Readables(), 0);
            Assert.AreEqual(buf.Writeables(), 254);
        }