Beispiel #1
0
        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());
            }
        }
Beispiel #2
0
        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());
            }
        }