Exemplo n.º 1
0
        public void TestNegativeCount()
        {
            var buf   = new byte[500];
            var count = m_memStream.Read(buf, 0, -1);

            Assert.AreEqual <int>(0, count, "Should read 0 bytes when asking for a negative number of bytes");
        }
Exemplo n.º 2
0
        public void TestChangingBuffer()
        {
            var buffer = new byte[BUFFER_SIZE];

            m_memStream = new CMemoryStream(m_buf1);
            m_memStream.Read(buffer, 0, m_buf1.Length);

            Assert.AreEqual <long>(m_buf1.Length, m_memStream.Position, "Position");
            Assert.AreEqual <long>(m_buf1.Length, m_memStream.Length, "Length");
            Assert.AreEqual <long>(0, m_memStream.BytesAvailable, "Bytes Available");

            Assert.AreEqual(0, MemCmp(m_buf1, 0, buffer, 0, m_buf1.Length), "Should have read buf1");

            m_memStream.SetBuffer(m_buf2);
            m_memStream.Read(buffer, 0, m_buf2.Length);

            Assert.AreEqual <long>(m_buf2.Length, m_memStream.Position, "Position2");
            Assert.AreEqual <long>(m_buf2.Length, m_memStream.Length, "Length2");
            Assert.AreEqual <long>(0, m_memStream.BytesAvailable, "Bytes Available2");

            Assert.AreEqual(0, MemCmp(m_buf2, 0, buffer, 0, m_buf2.Length), "Should have read buf2");
        }