示例#1
0
        public void TwoStreamsSeekIntoFirst()
        {
            concatStreamSourceData.Position.Returns(1);

            var cs = new ConcatStream();

            cs.AppendSource(concatStreamSourceDataUsed);
            cs.AppendSource(concatStreamSourceData);

            var res = cs.Seek(-2, System.IO.SeekOrigin.Current);

            Assert.That(res, Is.EqualTo(StreamSourceDefaultLength - 1));

            concatStreamSourceDataUsed.ReceivedWithAnyArgs().Position = StreamSourceDefaultLength - 1;
            concatStreamSourceData.ReceivedWithAnyArgs().Position     = 0;
        }
示例#2
0
        public void TwoStreamsSeekIntoSecond()
        {
            concatStreamSourceData.Position.Returns(StreamSourceDefaultLength - 1);

            concatStreamSourceNoData.Length.Returns(StreamSourceDefaultLength); // Just to prevent making and setting up a new mock

            var cs = new ConcatStream();

            cs.AppendSource(concatStreamSourceData);
            cs.AppendSource(concatStreamSourceNoData);

            var res = cs.Seek(2, System.IO.SeekOrigin.Current);

            Assert.That(res, Is.EqualTo(StreamSourceDefaultLength + 1));

            concatStreamSourceData.ReceivedWithAnyArgs().Position   = StreamSourceDefaultLength;
            concatStreamSourceNoData.ReceivedWithAnyArgs().Position = 1;
        }
示例#3
0
        public void OnePopulatedStreamSeekBeginZeroChanged()
        {
            concatStreamSourceData.Position.Returns(1);

            var cs = new ConcatStream();

            cs.AppendSource(concatStreamSourceData);

            var res = cs.Seek(0, System.IO.SeekOrigin.Begin);

            Assert.That(res, Is.Zero);

            concatStreamSourceData.ReceivedWithAnyArgs().Position = 0;
        }