public void TestResolableGetsCorrectPositionWithLayoutNone() { var rwt = new RWTest("key", "value"); FormatBuilder builder = new FormatBuilder(20).AppendFormatLine(" {position} {position}\r\n{position}"); Assert.AreEqual(" 1 3\r\n0\r\n", builder.ToString(rwt)); }
public void TestResolableGetsCorrectPositionWithLayoutLeft() { var rwt = new RWTest("key", "value"); FormatBuilder builder = new FormatBuilder(20, alignment: Alignment.Left).AppendFormatLine(" {position} {position}\r\n{position}"); // Position is always pre-alignment... Assert.AreEqual("1 3\r\n0\r\n", builder.ToString(rwt)); }
public void TestNestedResolvable() { var rwt = new RWTest("key", "value"); FormatBuilder builder = new FormatBuilder(50) .AppendFormatLine("{nest}"); // Position is always pre-alignment... Assert.AreEqual("UnspecKeyUnspecValue\r\n", builder.ToString(rwt)); }
public void TestNestedFormat() { var rwt = new RWTest("key", "value"); FormatBuilder builder = new FormatBuilder(10, firstLineIndentSize: 2, indentSize: 4, alignment: Alignment.Left) .AppendFormatLine("{key:-{position:-{value}}}"); // Position is always pre-alignment... Assert.AreEqual(" --value\r\n", builder.ToString(rwt)); }
public void TestDynamicFill() { var rwt = new RWTest("key", "value"); FormatBuilder builder = new FormatBuilder(10, firstLineIndentSize: 2, indentSize: 4, alignment: Alignment.Left) .AppendFormatLine("{!fill}a{!fill}{!fill}"); // Position is always pre-alignment... Assert.AreEqual(" --------\r\n a\r\n --------\r\n --------\r\n\r\n", builder.ToString(rwt)); }
public void TestResolableRespectsAlignmentOnDefault() { var rwt = new RWTest("key", "value"); FormatBuilder builder = new FormatBuilder(12, alignment: Alignment.Centre).AppendFormatLine("{0}", rwt); FormatBuilder builder2 = new FormatBuilder(12, alignment: Alignment.Centre).AppendFormatLine("{0:{Verbose}}", rwt); Assert.AreEqual(" keyvalue\r\n", builder.ToString()); Assert.AreEqual(" keyvalue\r\n", builder2.ToString()); }