예제 #1
0
        public static void TryGetBuffer_Constructor_Int32_WhenWritingPastCapacity_ReturnsDifferentArrays()
        {
            var stream = new MemoryStream(512);

            ArraySegment <byte> result1;

            Assert.True(stream.TryGetBuffer(out result1));

            // Force the stream to resize the underlying array
            stream.Write(new byte[1024], 0, 1024);

            ArraySegment <byte> result2;

            Assert.True(stream.TryGetBuffer(out result2));

            Assert.AreNotDeepEqual(result1.Array, result2.Array);
        }