public void FixedStringBuilder_TryExpand_Can_Always_Expand_Capacity()
        {
            FixedStringBuilder target = new FixedStringBuilder(1);

            Assert.IsTrue(target.TryAppend('X', 0));
            Assert.IsTrue(target.TryExpand(2));
            Assert.IsTrue(target.TryAppend('X', 0));
            Assert.AreEqual("XX", target.ToString());
        }
        public void FixedStringBuilder_TryExpand_Does_Nothing_If_Capacity_Is_Already_Larger()
        {
            FixedStringBuilder target = new FixedStringBuilder(3);

            Assert.IsTrue(target.TryAppend('X', 0));
            Assert.IsFalse(target.TryExpand(2));
            Assert.IsTrue(target.TryAppend('X', 0));
            Assert.IsTrue(target.TryAppend('X', 0));
            Assert.AreEqual("XXX", target.ToString());
        }
        public void FixedStringBuilder_TryExpand_Rejects_Negative_Capacity()
        {
            FixedStringBuilder target = new FixedStringBuilder(0);

            try
            {
                target.TryExpand(-1);
                Assert.Fail();
            }
            catch (ArgumentOutOfRangeException ex)
            {
                Assert.AreEqual(typeof(ArgumentOutOfRangeException), ex.GetType());
            }
        }