Пример #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);
        }