コード例 #1
0
        public void CharAtCorrectlyReturnsLocation()
        {
            var buffer = new LineTrackingStringBuffer("foo\rbar\nbaz\r\nbiz", "test.cshtml");
            var chr    = buffer.CharAt(14);

            Assert.Equal('i', chr.Character);
            Assert.Equal(new SourceLocation("test.cshtml", 14, 3, 1), chr.Location);
        }
コード例 #2
0
        public SeekableTextReader(char[] source, string filePath)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            _buffer = new LineTrackingStringBuffer(source, filePath);
            UpdateState();
        }
コード例 #3
0
        public void CtorInitializesProperties()
        {
            var buffer = new LineTrackingStringBuffer(string.Empty, "test.cshtml");

            Assert.Equal(0, buffer.Length);
        }