예제 #1
0
        public void TestCloneRemovesReadonly()
        {
            FormatBuilder builder  = new FormatBuilder("Test", true);
            FormatBuilder builder2 = builder.Clone();

            Assert.IsTrue(builder.IsReadOnly);
            Assert.IsFalse(builder2.IsReadOnly);
            builder2.AppendLine();
        }
예제 #2
0
        public void TestCloneFormatBuilder()
        {
            FormatBuilder builder = new FormatBuilder()
                                    .AppendLayout(50)
                                    .AppendLine(FormatResources.LoremIpsum)
                                    .AppendForegroundColor("Red")
                                    .AppendLine(FormatResources.SedUtPerspiciatis)
                                    .AppendLine(FormatResources.AtVeroEos)
                                    .AppendFormatLine("Some text with a {0} thing", "format");

            FormatBuilder clone = builder.Clone();

            Assert.AreEqual(builder.ToString(), clone.ToString());
        }
예제 #3
0
        public void TestCloneAddsReadonly()
        {
            FormatBuilder builder  = new FormatBuilder("Test");
            FormatBuilder builder2 = builder.Clone(true);

            Assert.IsFalse(builder.IsReadOnly);
            Assert.IsTrue(builder2.IsReadOnly);
            bool thrown;

            try
            {
                builder2.AppendLine();
                thrown = false;
            }
            catch (Exception)
            {
                thrown = true;
            }
            Assert.IsTrue(thrown);
        }
        public void TestCloneLayoutBuilder()
        {
            FormatBuilder builder = new FormatBuilder(50)
                .AppendLine(FormatResources.LoremIpsum)
                .AppendForegroundColor("Red")
                .AppendLine(FormatResources.SedUtPerspiciatis)
                .AppendLine(FormatResources.AtVeroEos)
                .AppendFormatLine("Some text with a {0} thing", "format");

            FormatBuilder clone = builder.Clone();

            Assert.IsInstanceOfType(clone, typeof (FormatBuilder));

            Assert.AreEqual(builder.ToString(), clone.ToString());
        }
예제 #5
0
        public void TestCloneKeepsReadonly()
        {
            FormatBuilder builder = new FormatBuilder("Test", true);
            FormatBuilder builder2 = builder.Clone(true);
            Assert.IsTrue(builder.IsReadOnly);
            Assert.IsTrue(builder2.IsReadOnly);

            bool thrown;
            try
            {
                builder2.AppendLine();
                thrown = false;
            }
            catch (Exception)
            {
                thrown = true;
            }
            Assert.IsTrue(thrown);
        }
예제 #6
0
 public void TestCloneRemovesReadonly()
 {
     FormatBuilder builder = new FormatBuilder("Test", true);
     FormatBuilder builder2 = builder.Clone();
     Assert.IsTrue(builder.IsReadOnly);
     Assert.IsFalse(builder2.IsReadOnly);
     builder2.AppendLine();
 }