Пример #1
0
        public virtual void testReadByteslen()
        {
            PrefixInputStream pis = new PrefixInputStream("abc", new MemoryStream(Encoding.Default.GetBytes("123")));

            byte[] b = new byte[2];
            Assert.AreEqual(2, pis.read(b, 0, 2));
            Assert.AreEqual(1, pis.read(b, 0, 2));
            Assert.AreEqual(2, pis.read(b, 0, 2));
            Assert.AreEqual(1, pis.read(b, 0, 2));
            Assert.AreEqual(-1, pis.read(b, 0, 2));
        }
Пример #2
0
        public virtual void testRead()
        {
            PrefixInputStream pis = new PrefixInputStream("abc", new MemoryStream(Encoding.Default.GetBytes("123")));

            Assert.AreEqual((int)'a', pis.read());
            Assert.AreEqual((int)'b', pis.read());
            Assert.AreEqual((int)'c', pis.read());
            Assert.AreEqual((int)'1', pis.read());
            Assert.AreEqual((int)'2', pis.read());
            Assert.AreEqual((int)'3', pis.read());
            Assert.AreEqual(-1, pis.read());
        }