public void TestCloneRemovesReadonly() { FormatBuilder builder = new FormatBuilder("Test", true); FormatBuilder builder2 = builder.Clone(); Assert.IsTrue(builder.IsReadOnly); Assert.IsFalse(builder2.IsReadOnly); builder2.AppendLine(); }
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()); }
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()); }
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); }