Ejemplo n.º 1
0
        public void Test_EmptyStringBuilder()
        {
            var sb = new SimpleStringBuilder();

            Assume.That(sb.IsDisposed, Is.True);
            Assert.That(() => sb.Capacity, Throws.InstanceOf <NullReferenceException>());
            Assert.That(() => sb.Dispose(), Throws.Nothing);
        }
Ejemplo n.º 2
0
        public void SimpleStringBuilder_AppendChar_Dispose()
        {
            var builder = new SimpleStringBuilder(N + 4);

            try
            {
                var c = X;

                for (var i = 0; i < N; i++)
                {
                    // ReSharper disable once PossiblyImpureMethodCallOnReadonlyVariable
                    builder.Append(c);
                }

                _str = builder.ToString();
            }
            finally
            {
                builder.Dispose();
            }
        }