public void Should_write_extra_line_after_object() { IObjectWriter prettySut = new JsonLogWriter(Formatting.None, true); var result = prettySut.WriteProperty("property", 1.5).ToString(); Assert.Equal(@"{""property"":1.5}NL".Replace("NL", Environment.NewLine), result); }
private static string MakeTestCall(Action <IObjectWriter> writer) { IObjectWriter sut = new JsonLogWriter(); writer(sut); return(sut.ToString()); }
public void Should_write_pretty_json() { IObjectWriter prettySut = new JsonLogWriter(Formatting.Indented); var result = prettySut.WriteProperty("property", 1.5).ToString(); Assert.Equal(@"{NL ""property"": 1.5NL}".Replace("NL", Environment.NewLine), result); }
public IObjectWriter Create() { if (pool.TryPop(out var writer)) { writer.Reset(); } else { writer = new JsonLogWriter(formatting, formatLine); } return(writer); }