public void Output_Of_String() { var so = new ZStringOutput(); so.Write("text", null); Assert.AreEqual("text", so.ToString()); }
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")); }
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()); }
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}")); }
public void Create_With_Capacity() { using var zStringOutput = new ZStringOutput(SmartFormat.Utilities.ZStringBuilderExtensions.DefaultBufferSize + 10000); Assert.That(zStringOutput.Output, Is.InstanceOf <ZStringBuilder>()); Assert.That(zStringOutput, Is.Not.Null); }