Ejemplo n.º 1
0
        public void TestNotSupportSeekOrigin()
        {
            var baseStream    = "hello world , my name is miaomiao".ToStream();
            var segmentStream = new SegmentStream(baseStream, 11);

            segmentStream.Seek(0, (SeekOrigin)100);
        }
Ejemplo n.º 2
0
        public void TestSeekEnd()
        {
            var segment = new SegmentStream(foobarbaz, 7);

            segment.Seek(-3, SeekOrigin.End);
            Assert.AreEqual("bar", segment.ToText());
        }
Ejemplo n.º 3
0
        public void TestSeekSmallThenStart()
        {
            var segment = new SegmentStream(foobarbaz);

            segment.Seek(-999, SeekOrigin.Begin);
            Assert.AreEqual("foo bar baz", segment.ToText());
        }
Ejemplo n.º 4
0
        public void TestSeekEndToRead()
        {
            var segment = new SegmentStream(foobarbaz);

            segment.Seek(999, SeekOrigin.End);
            Assert.AreEqual(string.Empty, segment.ToText());
        }
Ejemplo n.º 5
0
        public void TestSeekSmallThenStart()
        {
            var baseStream    = "hello world , my name is miaomiao".ToStream();
            var segmentStream = new SegmentStream(baseStream, 11);

            segmentStream.Seek(-100, SeekOrigin.Begin);
            Assert.AreEqual("hello world", segmentStream.ToText());
        }
Ejemplo n.º 6
0
        public void TestSeekEndToRead()
        {
            var baseStream    = "hello world , my name is miaomiao".ToStream();
            var segmentStream = new SegmentStream(baseStream, 11);

            segmentStream.Seek(100, SeekOrigin.End);
            Assert.AreEqual(string.Empty, segmentStream.ToText());
        }
Ejemplo n.º 7
0
        public void TestSeekCurrent()
        {
            foobarbaz.Seek(2, SeekOrigin.Begin);
            var segment = new SegmentStream(foobarbaz, 5);

            segment.Seek(2, SeekOrigin.Current);
            Assert.AreEqual("bar", segment.ToText());
        }
Ejemplo n.º 8
0
        public void TestSeekBegin()
        {
            var baseStream    = "hello world , my name is miaomiao".ToStream();
            var segmentStream = new SegmentStream(baseStream, 11);

            segmentStream.ToText(null, false);
            segmentStream.Seek(0, SeekOrigin.Begin);
            Assert.AreEqual("hello world", segmentStream.ToText());
        }
Ejemplo n.º 9
0
        public void TestSeekEnd()
        {
            var baseStream    = "hello world , my name is miaomiao".ToStream();
            var segmentStream = new SegmentStream(baseStream, 11);

            segmentStream.Seek(-5, SeekOrigin.End);

            Assert.AreEqual("world", segmentStream.ToText());
        }
Ejemplo n.º 10
0
        public void TestSeekBegin()
        {
            var segment = new SegmentStream(foobarbaz, 7);

            segment.ToText(null, false);

            segment.Seek(0, SeekOrigin.Begin);
            Assert.AreEqual("foo bar", segment.ToText());
        }
Ejemplo n.º 11
0
        public void TestSeekCurrent()
        {
            var baseStream = "hello world , my name is miaomiao".ToStream();

            baseStream.Seek(2, SeekOrigin.Begin);
            var segmentStream = new SegmentStream(baseStream, 9);

            segmentStream.Seek(4, SeekOrigin.Current);
            Assert.AreEqual("world", segmentStream.ToText());
        }