示例#1
0
        public void CopyToMemoryStream_WhenCopyingEntireStream_CreatesStreamOfSameLength()
        {
            var source = GetSource();
            var sink   = StreamUtils.CopyToMemoryStream(source, true, 100);

            Assert.AreEqual(source.Length, sink.Length);
        }
示例#2
0
        public void CopyToMemoryStream_WhenLengthSmallerThanChunkSize_CopiesWholeStream()
        {
            var source = GetSource();
            var sink   = StreamUtils.CopyToMemoryStream(source, true, 100);

            Assert.AreEqual(source.Length, sink.Length);
        }
示例#3
0
        public void CopyToMemoryStream_WhenLengthLargerThanAndMultipleOfChunkSize_CopiesWholeStream()
        {
            var source = GetSource();
            var sink   = StreamUtils.CopyToMemoryStream(source, true, 6);

            Assert.AreEqual(source.Length, sink.Length);
        }
示例#4
0
        public void CopyToMemoryStream_WhenCopyingEntireStreamNotPositionedAtBeginning_CreatesStreamOfSameLength()
        {
            var source = GetSource();

            source.Seek(5, SeekOrigin.Begin);
            var sink = StreamUtils.CopyToMemoryStream(source, true, 100);

            Assert.AreEqual(source.Length, sink.Length);
        }
示例#5
0
        public void CopyToMemoryStream_WhenNotCopyingEntireStream_CreatesStreamOfRemainingLength()
        {
            var source = GetSource();
            var offset = 5;

            source.Seek(offset, SeekOrigin.Begin);
            var sink = StreamUtils.CopyToMemoryStream(source, false, 100);

            Assert.AreEqual(source.Length - offset, sink.Length);
        }