Exemplo n.º 1
0
        public void should_not_be_able_to_skip_backwards()
        {
            BufferListStream sut = new BufferListStream();

            sut.Initialize(new[] { GetSegment(new byte[] { 0x01, 0x02, 0x03, 0x04 }, 123, 1024) });
            sut.Position = 1;
            sut.Skip(-1);
        }
Exemplo n.º 2
0
        public void should_be_able_to_skip_to_the_end_of_all_the_buffers()
        {
            int segmentSize = 16;
            BufferListStream            sut      = new BufferListStream();
            List <ArraySegment <byte> > segments = new List <ArraySegment <byte> >();

            segments.Add(GetSegment(new byte[segmentSize], 512, 1024));
            segments.Add(GetSegment(new byte[segmentSize], 512, 1024));
            sut.Initialize(segments);

            sut.Skip(segmentSize * 2);
        }
Exemplo n.º 3
0
        public void should_be_able_to_call_skip_to_advance_the_position()
        {
            BufferListStream sut = new BufferListStream();

            sut.Initialize(new[] { GetSegment(new byte[] { 0x01 }, 123, 1024) });

            // pre-condition
            Assert.AreEqual(1, sut.Length);

            // act
            var actual = sut.Skip(1);

            // assert
            Assert.NotNull(actual);
            Assert.AreEqual(1, sut.Position);
        }