public void TestCopyToNewArray() { var array = new byte[] { 0, 1, 2, 3, 4, 5 }; var chunkedStream = new ChunkedStream(); chunkedStream.Write(array, 1, 3); chunkedStream.Write(array, 2, 4); chunkedStream.Write(array, 3, 3); var destArray = chunkedStream.AsArray(); Assert.AreEqual(destArray[0], array[1]); Assert.AreEqual(destArray[1], array[2]); Assert.AreEqual(destArray[2], array[3]); Assert.AreEqual(destArray[3], array[2]); Assert.AreEqual(destArray[4], array[3]); Assert.AreEqual(destArray[5], array[4]); Assert.AreEqual(destArray[6], array[5]); Assert.AreEqual(destArray[7], array[3]); Assert.AreEqual(destArray[8], array[4]); Assert.AreEqual(destArray[9], array[5]); }