public void TextSectionWithDifferentLengthAreNotEqual() { TextSection lhs = new TextSection(0, 15); TextSection rhs = new TextSection(0, 1); Assert.IsFalse(lhs.Equals(rhs)); }
public void TextSectionWithSameOffsetAndLengthAreEqual() { TextSection lhs = new TextSection(0, 1); TextSection rhs = new TextSection(0, 1); Assert.IsTrue(lhs.Equals(rhs)); }
public void TextEditorDocumentGetTextReturnsCorrectSectionOfText() { TextSection expectedSection = new TextSection(0, 5); MockDocument document = new MockDocument(); document.Text = "abcdefghi"; Assert.AreEqual("def", document.GetText(3, 3)); }
public void TextEditorDocumentCanGetOffsetAndLengthUsedAsParametersInGetTextMethod() { TextSection expectedSection = new TextSection(0, 5); document.Text = "abcdefghi"; document.GetText(0, 5); Assert.AreEqual(expectedSection, document.GetTextSectionUsedWithGetTextMethod()); }
public string GetText(int offset, int length) { textSectionUsedWithGetTextMethod = new TextSection(offset, length); return(text.Substring(offset, length)); }
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()); }
public string GetText(int offset, int length) { textSectionUsedWithGetTextMethod = new TextSection(offset, length); return text.Substring(offset, length); }