コード例 #1
0
        public void TestReadByteEOS()
        {
            BigMemoryStream stream = new BigMemoryStream(100);

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

            Assert.AreEqual(-1, b);
        }
コード例 #2
0
        public void TestReadLastByteUnsetWithMaxSizeOfUnderlyingStream()
        {
            BigMemoryStream stream = new BigMemoryStream(BigMemoryStream.MEMORY_STREAM_MAX_SIZE);

            stream.Position = stream.Length - 1;

            int b = stream.ReadByte();

            Assert.AreEqual(0, b);
        }
コード例 #3
0
        public void TestReadLastByteUnset()
        {
            BigMemoryStream stream = new BigMemoryStream(100);

            stream.Position = stream.Length - 1;

            int b = stream.ReadByte();

            Assert.AreEqual(0, b);
        }
コード例 #4
0
        public void TestReadByteEOSBig()
        {
            long            length = 3L * 1024L * 1024L * 1024L; //3GiB
            BigMemoryStream stream = new BigMemoryStream(length);

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

            Assert.AreEqual(-1, b);
        }
コード例 #5
0
        public void TestReadWriteByte()
        {
            BigMemoryStream stream = new BigMemoryStream(100);

            stream.WriteByte(5);

            stream.Position = 0;

            Assert.AreEqual(5, stream.ReadByte());
        }
コード例 #6
0
        public void TestPositionMovesOnReadByte()
        {
            BigMemoryStream stream = new BigMemoryStream(100);

            stream.Position = 5;

            stream.ReadByte();

            Assert.AreEqual(6, stream.Position);
        }
コード例 #7
0
        public void TestReadLastByteUnsetBig()
        {
            long            length = 3L * 1024L * 1024L * 1024L; //3GiB
            BigMemoryStream stream = new BigMemoryStream(length);

            stream.Position = stream.Length - 1;

            int b = stream.ReadByte();

            Assert.AreEqual(0, b);
        }
コード例 #8
0
        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);
        }
コード例 #9
0
        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);
        }
コード例 #10
0
        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);
        }
コード例 #11
0
        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);
        }