Exemplo n.º 1
0
        public void Output_Of_String()
        {
            var so = new ZStringOutput();

            so.Write("text", null);
            Assert.AreEqual("text", so.ToString());
        }
Exemplo n.º 2
0
 public void Create_With_Other_ValueStringBuilder()
 {
     using var vsb = SmartFormat.Utilities.ZStringBuilderExtensions.CreateZStringBuilder();
     vsb.Append("text");
     using var zStringOutput = new ZStringOutput(vsb);
     Assert.That(zStringOutput, Is.Not.Null);
     Assert.That(zStringOutput.ToString(), Is.EqualTo("text"));
 }
Exemplo n.º 3
0
        public void Output_Of_ValueStringBuilder()
        {
            var so = new ZStringOutput();

            using var sb = SmartFormat.Utilities.ZStringBuilderExtensions.CreateZStringBuilder();
            sb.Append("text");
            so.Write(sb, null);
            Assert.AreEqual("text", so.ToString());
        }
Exemplo n.º 4
0
        public void Format_WithCache_Into_ZStringOutput()
        {
            var data         = new { Name = "Joe", City = "Melbourne" };
            var formatter    = GetSimpleFormatter();
            var formatString = "{Name}, {City}";
            var format       = formatter.Parser.ParseFormat(formatString);

            using var output = new ZStringOutput();
            formatter.FormatInto(output, null, format, data);
            Assert.That(output.ToString(), Is.EqualTo($"{data.Name}, {data.City}"));
        }