Пример #1
0
		public void TextSectionWithDifferentLengthAreNotEqual()
		{
			TextSection lhs = new TextSection(0, 15);
			TextSection rhs = new TextSection(0, 1);
			
			Assert.IsFalse(lhs.Equals(rhs));
		}
Пример #2
0
		public void TextSectionWithSameOffsetAndLengthAreEqual()
		{
			TextSection lhs = new TextSection(0, 1);
			TextSection rhs = new TextSection(0, 1);
			
			Assert.IsTrue(lhs.Equals(rhs));
		}
Пример #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));
		}
Пример #4
0
		public void TextEditorDocumentCanGetOffsetAndLengthUsedAsParametersInGetTextMethod()
		{
			TextSection expectedSection = new TextSection(0, 5);
			
			document.Text = "abcdefghi";
			document.GetText(0, 5);
			
			Assert.AreEqual(expectedSection, document.GetTextSectionUsedWithGetTextMethod());
		}
Пример #5
0
 public string GetText(int offset, int length)
 {
     textSectionUsedWithGetTextMethod = new TextSection(offset, length);
     return(text.Substring(offset, length));
 }
Пример #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());
		}
Пример #8
0
		public string GetText(int offset, int length)
		{
			textSectionUsedWithGetTextMethod = new TextSection(offset, length);
			return text.Substring(offset, length);
		}