Exemplo n.º 1
0
		public void TextSectionWithDifferentLengthAreNotEqual()
		{
			TextSection lhs = new TextSection(0, 15);
			TextSection rhs = new TextSection(0, 1);
			
			Assert.IsFalse(lhs.Equals(rhs));
		}
Exemplo n.º 2
0
		public void TextSectionWithSameOffsetAndLengthAreEqual()
		{
			TextSection lhs = new TextSection(0, 1);
			TextSection rhs = new TextSection(0, 1);
			
			Assert.IsTrue(lhs.Equals(rhs));
		}
Exemplo n.º 3
0
		public void TextEditorDocumentGetTextReturnsCorrectSectionOfText()
		{
			TextSection expectedSection = new TextSection(0, 5);
			
			MockDocument document = new MockDocument();
			document.Text = "abcdefghi";
			
			Assert.AreEqual("def", document.GetText(3, 3));
		}
Exemplo n.º 4
0
		public void TextEditorDocumentCanGetOffsetAndLengthUsedAsParametersInGetTextMethod()
		{
			TextSection expectedSection = new TextSection(0, 5);
			
			document.Text = "abcdefghi";
			document.GetText(0, 5);
			
			Assert.AreEqual(expectedSection, document.GetTextSectionUsedWithGetTextMethod());
		}
Exemplo n.º 5
0
 public string GetText(int offset, int length)
 {
     textSectionUsedWithGetTextMethod = new TextSection(offset, length);
     return(text.Substring(offset, length));
 }
Exemplo n.º 6
0
        public override bool Equals(object obj)
        {
            TextSection rhs = obj as TextSection;

            return((rhs.offset == offset) && (rhs.length == length));
        }
		public void TextEditorDocumentGetTextCalledWithOffsetAndLength()
		{
			TextSection expectedTextSection = new TextSection(0, 8);
			Assert.AreEqual(expectedTextSection, textEditor.MockDocument.GetTextSectionUsedWithGetTextMethod());
		}
Exemplo n.º 8
0
		public string GetText(int offset, int length)
		{
			textSectionUsedWithGetTextMethod = new TextSection(offset, length);
			return text.Substring(offset, length);
		}