System.Text.Tests.StringBuilderTests.Replace_Char C# (CSharp) Method

Replace_Char() private method

private Replace_Char ( string value, char oldChar, char newChar, int startIndex, int count, string expected ) : void
value string
oldChar char
newChar char
startIndex int
count int
expected string
return void
        public static void Replace_Char(string value, char oldChar, char newChar, int startIndex, int count, string expected)
        {
            StringBuilder builder;
            if (startIndex == 0 && count == value.Length)
            {
                // Use Replace(char, char)
                builder = new StringBuilder(value);
                builder.Replace(oldChar, newChar);
                Assert.Equal(expected, builder.ToString());
            }
            // Use Replace(char, char, int, int)
            builder = new StringBuilder(value);
            builder.Replace(oldChar, newChar, startIndex, count);
            Assert.Equal(expected, builder.ToString());
        }
StringBuilderTests