public void InsertTest() { string s = " That is text."; var newText1 = text.Insert(20, s); var newString1 = text.Text.Insert(20, s); var newText2 = text.Insert(20, s, SpanOperand.Left); var newString2 = text.Text.Insert(20, s); Assert.AreEqual(newText1[1].Text.StartsWith(s), true); Assert.AreEqual(newText2[0].Text.EndsWith(s), true); Assert.AreEqual(newText1.Length, text.Length); Assert.AreEqual(newText2.Length, text.Length); Assert.AreEqual(newText1.Text, newString1); Assert.AreEqual(newText2.Text, newString2); Assert.AreEqual(text.AnySpanReferenceEquals(newText1), false); Assert.AreEqual(text.AnySpanReferenceEquals(newText2), false); }
public void ReplaceSpanTest() { Span span = new Span() { Text = "This is text." }; FormattedString newText = text.ReplaceSpan(span, new Span()); Assert.AreEqual(newText.Length, text.Length); Assert.AreEqual(newText.Text, text.Text.Replace(span.Text, null)); Assert.AreEqual(newText.AnySpanReferenceEquals(text), false); }