public virtual void TestNonBlockingPartialRead() { InputStream errorReadStream = new _InputStream_251(); UnionInputStream u = new UnionInputStream(new ByteArrayInputStream(new byte[] { 1 , 2, 3 }), errorReadStream); byte[] buf = new byte[10]; NUnit.Framework.Assert.AreEqual(3, u.Read(buf, 0, 10)); NUnit.Framework.Assert.IsTrue(Arrays.Equals(new byte[] { 1, 2, 3 }, Slice(buf, 3) )); try { u.Read(buf, 0, 1); NUnit.Framework.Assert.Fail("Expected exception from errorReadStream"); } catch (IOException e) { NUnit.Framework.Assert.AreEqual("Expected", e.Message); } }
public virtual void TestNonBlockingPartialRead() { InputStream errorReadStream = new _InputStream_251(); UnionInputStream u = new UnionInputStream(new ByteArrayInputStream(new byte[] { 1 , 2, 3 }), errorReadStream); byte[] buf = new byte[10]; NUnit.Framework.Assert.AreEqual(3, u.Read(buf, 0, 10)); NUnit.Framework.Assert.IsTrue(Arrays.Equals(new byte[] { 1, 2, 3 }, Slice(buf, 3) )); try { u.Read(buf, 0, 1); NUnit.Framework.Assert.Fail("Expected exception from errorReadStream"); } catch (IOException e) { NUnit.Framework.Assert.AreEqual("Expected", e.Message); } }