Beispiel #1
0
        public virtual void TestAppendChars()
        {
            char[]   chars = new char[] { 'a', 'b', 'c', 'd' };
            CharsRef c     = new CharsRef(chars, 1, 3); // bcd

            c.Append(new char[] { 'e' }, 0, 1);
            Assert.AreEqual("bcde", c.ToString());
        }
Beispiel #2
0
        public virtual void TestAppend()
        {
            CharsRef      @ref       = new CharsRef();
            StringBuilder builder    = new StringBuilder();
            int           numStrings = AtLeast(10);

            for (int i = 0; i < numStrings; i++)
            {
                char[] charArray = TestUtil.RandomRealisticUnicodeString(Random, 1, 100).ToCharArray();
                int    offset    = Random.Next(charArray.Length);
                int    length    = charArray.Length - offset;
                builder.Append(charArray, offset, length);
                @ref.Append(charArray, offset, length);
            }

            Assert.AreEqual(builder.ToString(), @ref.ToString());
        }