public void ExtractParameterOrderDoesNotMatter(int insertionIndex) { var caret = Content.CursorFromGraphemeIndex(insertionIndex); var originalText = Content.AsText(); var content = new TextBlockContent(); content.Insert(content.GetCaretAtStart(), "ABCDEFGHIJ"); var newPosition = Content.Insert(caret, content); // make sure the inserted text is correct by comparing the text we get by simply inserted the // same text into a string. var expectedFinalText = originalText.Insert(insertionIndex, content.AsText()); DidYouKnow.That(Content.AsText()).Should().Be(expectedFinalText); // make sure the caret returned is correct by comparing it to the text that should come after // the caret. var expectedAfterText = originalText.Substring(0, insertionIndex) + "ABCDEFGHIJ"; DidYouKnow.That(Content.CloneContent(Content.GetCaretAtStart(), newPosition).AsText()) .Should().Be(expectedAfterText); }
public void VerifyExtractionEverywhere(int start, int end) { var originalText = Content.AsText(); var extracted = Content.ExtractContent(Content.CursorFromGraphemeIndex(start), Content.CursorFromGraphemeIndex(end)); var removedText = originalText.Substring(start, end - start); var modifiedText = originalText.Remove(start, end - start); DidYouKnow.That(Content.AsText()).Should().Be(modifiedText); DidYouKnow.That(extracted.AsText()).Should().Be(removedText); }