コード例 #1
0
        public void TestSeek()
        {
            _reader.Seek(9, System.IO.SeekOrigin.Current);

            Assert.Equal <long>(9, _reader.Position);
            Assert.Equal <byte>(0x46, _reader.ReadByte());
            Assert.Equal <long>(10, _reader.Position);

            _reader.Seek(0, System.IO.SeekOrigin.Begin);
            _reader.ReadBytes(4);
            Assert.Equal <long>(4, _reader.Position);

            _reader.Seek(2, System.IO.SeekOrigin.Begin);
            Assert.Equal <long>(2, _reader.Position);

            _reader.Seek(-2, System.IO.SeekOrigin.End);
            Assert.Equal <long>(14, _reader.Position);
        }
コード例 #2
0
        public void TestSeek()
        {
            _reader.Seek(9, System.IO.SeekOrigin.Current);

            Assert.AreEqual(_reader.Position, 9);
            Assert.AreEqual(0x46, _reader.ReadByte());
            Assert.AreEqual(10, _reader.Position);

            _reader.Seek(0, System.IO.SeekOrigin.Begin);
            _reader.ReadBytes(4);
            Assert.AreEqual(4, _reader.Position);

            _reader.Seek(2, System.IO.SeekOrigin.Begin);
            Assert.AreEqual(2, _reader.Position);

            _reader.Seek(-2, System.IO.SeekOrigin.End);
            Assert.AreEqual(14, _reader.Position);
        }