Ejemplo n.º 1
0
		public virtual void TestReadSingleBytes()
		{
			UnionInputStream u = new UnionInputStream();
			NUnit.Framework.Assert.IsTrue(u.IsEmpty());
			u.Add(new ByteArrayInputStream(new byte[] { 1, 0, 2 }));
			u.Add(new ByteArrayInputStream(new byte[] { 3 }));
			u.Add(new ByteArrayInputStream(new byte[] { 4, 5 }));
			NUnit.Framework.Assert.IsFalse(u.IsEmpty());
			NUnit.Framework.Assert.AreEqual(3, u.Available());
			NUnit.Framework.Assert.AreEqual(1, u.Read());
			NUnit.Framework.Assert.AreEqual(0, u.Read());
			NUnit.Framework.Assert.AreEqual(2, u.Read());
			NUnit.Framework.Assert.AreEqual(0, u.Available());
			NUnit.Framework.Assert.AreEqual(3, u.Read());
			NUnit.Framework.Assert.AreEqual(0, u.Available());
			NUnit.Framework.Assert.AreEqual(4, u.Read());
			NUnit.Framework.Assert.AreEqual(1, u.Available());
			NUnit.Framework.Assert.AreEqual(5, u.Read());
			NUnit.Framework.Assert.AreEqual(0, u.Available());
			NUnit.Framework.Assert.AreEqual(-1, u.Read());
			NUnit.Framework.Assert.IsTrue(u.IsEmpty());
			u.Add(new ByteArrayInputStream(new byte[] { unchecked((byte)255) }));
			NUnit.Framework.Assert.AreEqual(255, u.Read());
			NUnit.Framework.Assert.AreEqual(-1, u.Read());
			NUnit.Framework.Assert.IsTrue(u.IsEmpty());
		}
Ejemplo n.º 2
0
        public virtual void TestReadSingleBytes()
        {
            UnionInputStream u = new UnionInputStream();

            NUnit.Framework.Assert.IsTrue(u.IsEmpty());
            u.Add(new ByteArrayInputStream(new byte[] { 1, 0, 2 }));
            u.Add(new ByteArrayInputStream(new byte[] { 3 }));
            u.Add(new ByteArrayInputStream(new byte[] { 4, 5 }));
            NUnit.Framework.Assert.IsFalse(u.IsEmpty());
            NUnit.Framework.Assert.AreEqual(3, u.Available());
            NUnit.Framework.Assert.AreEqual(1, u.Read());
            NUnit.Framework.Assert.AreEqual(0, u.Read());
            NUnit.Framework.Assert.AreEqual(2, u.Read());
            NUnit.Framework.Assert.AreEqual(0, u.Available());
            NUnit.Framework.Assert.AreEqual(3, u.Read());
            NUnit.Framework.Assert.AreEqual(0, u.Available());
            NUnit.Framework.Assert.AreEqual(4, u.Read());
            NUnit.Framework.Assert.AreEqual(1, u.Available());
            NUnit.Framework.Assert.AreEqual(5, u.Read());
            NUnit.Framework.Assert.AreEqual(0, u.Available());
            NUnit.Framework.Assert.AreEqual(-1, u.Read());
            NUnit.Framework.Assert.IsTrue(u.IsEmpty());
            u.Add(new ByteArrayInputStream(new byte[] { unchecked ((byte)255) }));
            NUnit.Framework.Assert.AreEqual(255, u.Read());
            NUnit.Framework.Assert.AreEqual(-1, u.Read());
            NUnit.Framework.Assert.IsTrue(u.IsEmpty());
        }
Ejemplo n.º 3
0
		public virtual void TestEmptyStream()
		{
			UnionInputStream u = new UnionInputStream();
			NUnit.Framework.Assert.IsTrue(u.IsEmpty());
			NUnit.Framework.Assert.AreEqual(-1, u.Read());
			NUnit.Framework.Assert.AreEqual(-1, u.Read(new byte[1], 0, 1));
			NUnit.Framework.Assert.AreEqual(0, u.Available());
			NUnit.Framework.Assert.AreEqual(0, u.Skip(1));
			u.Close();
		}
Ejemplo n.º 4
0
        public virtual void TestEmptyStream()
        {
            UnionInputStream u = new UnionInputStream();

            NUnit.Framework.Assert.IsTrue(u.IsEmpty());
            NUnit.Framework.Assert.AreEqual(-1, u.Read());
            NUnit.Framework.Assert.AreEqual(-1, u.Read(new byte[1], 0, 1));
            NUnit.Framework.Assert.AreEqual(0, u.Available());
            NUnit.Framework.Assert.AreEqual(0, u.Skip(1));
            u.Close();
        }