System.Security.Tests.SecureStringTests.InsertAt_LongString C# (CSharp) Method

InsertAt_LongString() private method

private InsertAt_LongString ( ) : void
return void
        public static void InsertAt_LongString()
        {
            string initialValue = CreateString(ushort.MaxValue);

            for (int iter = 0; iter < 2; iter++)
            {
                using (SecureString testString = CreateSecureString(initialValue))
                {
                    string expected = initialValue;
                    AssertEquals(expected, testString);

                    if (iter == 0) // add at the beginning
                    {
                        expected = 'b' + expected;
                        testString.InsertAt(0, 'b');
                    }
                    else // add at the end
                    {
                        expected += 'b';
                        testString.InsertAt(testString.Length, 'b');
                    }

                    AssertEquals(expected, testString);
                }
            }
        }