示例#1
0
        public void StreamUtility_AppendTo_1()
        {
            byte[]       sourceArray       = { 1, 2, 3, 4 };
            MemoryStream sourceStream      = new MemoryStream(sourceArray);
            MemoryStream destinationStream = new MemoryStream();

            StreamUtility.AppendTo(sourceStream, destinationStream, -1);
            byte[] destinationArray = destinationStream.ToArray();
            Assert.AreEqual(4, destinationArray.Length);
            Assert.AreEqual(1, destinationArray[0]);
            Assert.AreEqual(2, destinationArray[1]);
            Assert.AreEqual(3, destinationArray[2]);
            Assert.AreEqual(4, destinationArray[3]);
        }