Beispiel #1
0
        public void WriteOverMiddleBoundryOfBothStreamsWithSeekDisabled()
        {
            // Arrange
            byte[] result        = new byte[1046];
            byte[] buffer1       = Encoding.ASCII.GetBytes("123");
            byte[] buffer2       = Encoding.ASCII.GetBytes("456");
            byte[] bufferToWrite = Encoding.ASCII.GetBytes("abcdef");

            MemoryStream stream1      = new MemoryStream(buffer1);
            MemoryStream stream2      = new MemoryStream(buffer2);
            ConcatStream streamToTest = new ConcatStream(stream1, stream2);

            // Act
            streamToTest.Write(bufferToWrite, 0, bufferToWrite.Length);

            //Assert
            string actual = streamToTest.ToString();

            Assert.IsFalse(streamToTest.CanSeek);

            for (int i = 0; i < bufferToWrite.Length; i++)
            {
                Assert.AreEqual(actual[i], bufferToWrite[i]);
            }
        }