public void TestReadWriteByte()
        {
            BigMemoryStream stream = new BigMemoryStream(100);

            stream.WriteByte(5);

            stream.Position = 0;

            Assert.AreEqual(5, stream.ReadByte());
        }
        public void TesPositionMovesOnWriteByte()
        {
            BigMemoryStream stream = new BigMemoryStream(100);

            stream.Position = 5;

            stream.WriteByte(3);

            Assert.AreEqual(6, stream.Position);
        }
        public void TestReadWriteLastByteInStreamAtMaxOfUnderlyingStream()
        {
            BigMemoryStream stream = new BigMemoryStream(BigMemoryStream.MEMORY_STREAM_MAX_SIZE);

            stream.Position = BigMemoryStream.MEMORY_STREAM_MAX_SIZE - 1;
            stream.WriteByte(5);

            stream.Position = BigMemoryStream.MEMORY_STREAM_MAX_SIZE - 1;
            int b = stream.ReadByte();

            Assert.AreEqual(5, b);
        }
        public void TestReadWriteLastByte()
        {
            BigMemoryStream stream = new BigMemoryStream(100);

            stream.Position = 99;
            stream.WriteByte(5);

            stream.Position = 99;
            int b = stream.ReadByte();

            Assert.AreEqual(5, b);
        }
        public void TestReadWriteFirstByteInSecondUnderlyingStream()
        {
            long            length = BigMemoryStream.MEMORY_STREAM_MAX_SIZE + 5;
            BigMemoryStream stream = new BigMemoryStream(length);

            stream.Position = BigMemoryStream.MEMORY_STREAM_MAX_SIZE;
            stream.WriteByte(5);

            stream.Position = BigMemoryStream.MEMORY_STREAM_MAX_SIZE;
            int b = stream.ReadByte();

            Assert.AreEqual(5, b);
        }
        public void TestReadWriteLastByteBig()
        {
            long            length = 3L * 1024L * 1024L * 1024L; //3GiB
            BigMemoryStream stream = new BigMemoryStream(length);

            stream.Position = length - 1;
            stream.WriteByte(5);

            stream.Position = length - 1;
            int b = stream.ReadByte();

            Assert.AreEqual(5, b);
        }