예제 #1
0
		public void EmptyReadOnlyDocument()
		{
			IDocument document = new ReadOnlyDocument(string.Empty);
			Assert.AreEqual(string.Empty, document.Text);
			Assert.AreEqual(0, document.TextLength);
			Assert.AreEqual(1, document.LineCount);
			Assert.AreEqual(0, document.GetOffset(1, 1));
			Assert.AreEqual(new TextLocation(1, 1), document.GetLocation(0));
			
			Assert.AreEqual(0, document.GetLineByNumber(1).Offset);
			Assert.AreEqual(0, document.GetLineByNumber(1).EndOffset);
			Assert.AreEqual(0, document.GetLineByNumber(1).Length);
			Assert.AreEqual(0, document.GetLineByNumber(1).TotalLength);
			Assert.AreEqual(0, document.GetLineByNumber(1).DelimiterLength);
			Assert.AreEqual(1, document.GetLineByNumber(1).LineNumber);
		}
예제 #2
0
        public void EmptyReadOnlyDocument()
        {
            IDocument document = new ReadOnlyDocument(string.Empty);

            Assert.AreEqual(string.Empty, document.Text);
            Assert.AreEqual(0, document.TextLength);
            Assert.AreEqual(1, document.LineCount);
            Assert.AreEqual(0, document.GetOffset(1, 1));
            Assert.AreEqual(new TextLocation(1, 1), document.GetLocation(0));

            Assert.AreEqual(0, document.GetLineByNumber(1).Offset);
            Assert.AreEqual(0, document.GetLineByNumber(1).EndOffset);
            Assert.AreEqual(0, document.GetLineByNumber(1).Length);
            Assert.AreEqual(0, document.GetLineByNumber(1).TotalLength);
            Assert.AreEqual(0, document.GetLineByNumber(1).DelimiterLength);
            Assert.AreEqual(1, document.GetLineByNumber(1).LineNumber);
        }
예제 #3
0
        public void SimpleDocument()
        {
            string    text     = "Hello\nWorld!\r\n";
            IDocument document = new ReadOnlyDocument(text);

            Assert.AreEqual(text, document.Text);
            Assert.AreEqual(3, document.LineCount);

            Assert.AreEqual(0, document.GetLineByNumber(1).Offset);
            Assert.AreEqual(5, document.GetLineByNumber(1).EndOffset);
            Assert.AreEqual(5, document.GetLineByNumber(1).Length);
            Assert.AreEqual(6, document.GetLineByNumber(1).TotalLength);
            Assert.AreEqual(1, document.GetLineByNumber(1).DelimiterLength);
            Assert.AreEqual(1, document.GetLineByNumber(1).LineNumber);

            Assert.AreEqual(6, document.GetLineByNumber(2).Offset);
            Assert.AreEqual(12, document.GetLineByNumber(2).EndOffset);
            Assert.AreEqual(6, document.GetLineByNumber(2).Length);
            Assert.AreEqual(8, document.GetLineByNumber(2).TotalLength);
            Assert.AreEqual(2, document.GetLineByNumber(2).DelimiterLength);
            Assert.AreEqual(2, document.GetLineByNumber(2).LineNumber);

            Assert.AreEqual(14, document.GetLineByNumber(3).Offset);
            Assert.AreEqual(14, document.GetLineByNumber(3).EndOffset);
            Assert.AreEqual(0, document.GetLineByNumber(3).Length);
            Assert.AreEqual(0, document.GetLineByNumber(3).TotalLength);
            Assert.AreEqual(0, document.GetLineByNumber(3).DelimiterLength);
            Assert.AreEqual(3, document.GetLineByNumber(3).LineNumber);
        }
예제 #4
0
		public void SimpleDocument()
		{
			string text = "Hello\nWorld!\r\n";
			IDocument document = new ReadOnlyDocument(text);
			Assert.AreEqual(text, document.Text);
			Assert.AreEqual(3, document.LineCount);
			
			Assert.AreEqual(0, document.GetLineByNumber(1).Offset);
			Assert.AreEqual(5, document.GetLineByNumber(1).EndOffset);
			Assert.AreEqual(5, document.GetLineByNumber(1).Length);
			Assert.AreEqual(6, document.GetLineByNumber(1).TotalLength);
			Assert.AreEqual(1, document.GetLineByNumber(1).DelimiterLength);
			Assert.AreEqual(1, document.GetLineByNumber(1).LineNumber);
			
			Assert.AreEqual(6, document.GetLineByNumber(2).Offset);
			Assert.AreEqual(12, document.GetLineByNumber(2).EndOffset);
			Assert.AreEqual(6, document.GetLineByNumber(2).Length);
			Assert.AreEqual(8, document.GetLineByNumber(2).TotalLength);
			Assert.AreEqual(2, document.GetLineByNumber(2).DelimiterLength);
			Assert.AreEqual(2, document.GetLineByNumber(2).LineNumber);

			Assert.AreEqual(14, document.GetLineByNumber(3).Offset);
			Assert.AreEqual(14, document.GetLineByNumber(3).EndOffset);
			Assert.AreEqual(0, document.GetLineByNumber(3).Length);
			Assert.AreEqual(0, document.GetLineByNumber(3).TotalLength);
			Assert.AreEqual(0, document.GetLineByNumber(3).DelimiterLength);
			Assert.AreEqual(3, document.GetLineByNumber(3).LineNumber);
		}