IronRuby.Tests.Tests.MutableString_Insert_Char C# (CSharp) Method

MutableString_Insert_Char() private method

private MutableString_Insert_Char ( ) : void
return void
        public void MutableString_Insert_Char() {
            var e = RubyEncoding.UTF8;

            MutableString x;
            x = MutableString.CreateMutable("12", e);
            x.Insert(0, '3');
            Assert(x.CompareTo(MS("312", e)) == 0);
            x.Insert(3, '4');
            Assert(x.CompareTo(MS("3124", e)) == 0);
            x.Insert(2, "");
            Assert(x.CompareTo(MS("3124", e)) == 0);
            x.Insert(1, "567");
            Assert(x.CompareTo(MS("3567124", e)) == 0);
            x.Insert(0, "8", 0, 1);
            Assert(x.CompareTo(MS("83567124", e)) == 0);
            x.Insert(0, MS("", e));
            Assert(x.CompareTo(MS("83567124", e)) == 0);
            x.Insert(5, MS("9Ω", e));
            Assert(x.CompareTo(MS("835679Ω124", e)) == 0);

            // Inserting Unicode string literal to a string doesn't check correctness of the resulting string.
            // An exception is thrown during subssequent operation that needs to convert the content.
            x = MS(((char)250).ToString(), RubyEncoding.Binary);
            x.Insert(0, 'α');
            AssertExceptionThrown<EncoderFallbackException>(() => x.ToByteArray());
        }
Tests