public void Replace_should_be_callable_indirectly() { using (new IndirectionsContext()) { // Arrange PStringBuilder.ReplaceCharCharInt32Int32().Body = (_, oldChar, newChar, startIndex, count) => { return(new StringBuilder("おはもに!")); }; // Act var sb = new StringBuilder("aaaa"); var actual = sb.Replace('a', 'b', 1, 2); // Assert Assert.AreEqual("おはもに!", actual.ToString()); } }
public void Insert_should_be_callable_indirectly() { using (new IndirectionsContext()) { // Arrange PStringBuilder.InsertInt32StringInt32().Body = (_, index, value, count) => { return(new StringBuilder("にゃんぱすー")); }; // Act var sb = new StringBuilder(); sb.Append("abd"); var actual = sb.Insert(2, "c", 3); // Assert Assert.AreEqual("にゃんぱすー", actual.ToString()); } }