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); }
public SeekableTextReader(char[] source, string filePath) { if (source == null) { throw new ArgumentNullException(nameof(source)); } _buffer = new LineTrackingStringBuffer(source, filePath); UpdateState(); }
public void CtorInitializesProperties() { var buffer = new LineTrackingStringBuffer(string.Empty, "test.cshtml"); Assert.Equal(0, buffer.Length); }