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(); }
public virtual void TestCloseDuringClose() { UnionInputStream u = new UnionInputStream(); bool[] closed = new bool[2]; u.Add(new _ByteArrayInputStream_207(closed, new byte[] { 1 })); u.Add(new _ByteArrayInputStream_212(closed, new byte[] { 2 })); NUnit.Framework.Assert.IsFalse(closed[0]); NUnit.Framework.Assert.IsFalse(closed[1]); u.Close(); NUnit.Framework.Assert.IsTrue(closed[0]); NUnit.Framework.Assert.IsTrue(closed[1]); }
public virtual void TestExceptionDuringClose() { UnionInputStream u = new UnionInputStream(); u.Add(new _ByteArrayInputStream_230(new byte[] { 1 })); try { u.Close(); NUnit.Framework.Assert.Fail("close ignored inner stream exception"); } catch (IOException e) { NUnit.Framework.Assert.AreEqual("I AM A TEST", e.Message); } }
public virtual void TestExceptionDuringClose() { UnionInputStream u = new UnionInputStream(); u.Add(new _ByteArrayInputStream_219(new byte[] { 1 })); try { u.Close(); NUnit.Framework.Assert.Fail("close ignored inner stream exception"); } catch (IOException e) { NUnit.Framework.Assert.AreEqual("I AM A TEST", e.Message); } }
public virtual void TestCloseDuringClose() { UnionInputStream u = new UnionInputStream(); bool[] closed = new bool[2]; u.Add(new _ByteArrayInputStream_196(closed, new byte[] { 1 })); u.Add(new _ByteArrayInputStream_201(closed, new byte[] { 2 })); NUnit.Framework.Assert.IsFalse(closed[0]); NUnit.Framework.Assert.IsFalse(closed[1]); u.Close(); NUnit.Framework.Assert.IsTrue(closed[0]); NUnit.Framework.Assert.IsTrue(closed[1]); }