You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using WriteFields as a shorthand for writing records without a record object, it seems that no header is written, even though one has been designated. Is this the expected behavior, or should it be consistent with writing records using record objects?
Note that the non-header records are written as expected.
public class ChoWriterTest { [Fact] public void WriteHeaderAndFields() { using var writer = new StringWriter(); using var choWriter = new ChoCSVWriter(writer).WithFirstLineHeader(); choWriter.WriteHeader("A", "B"); choWriter.WriteFields("A1", "B1"); choWriter.WriteFields("A2", "B2"); choWriter.Flush(); writer.Flush(); var result = writer.ToString(); Assert.StartsWith("A,B", result); } }
The text was updated successfully, but these errors were encountered:
Apologies for mangled formatting. Failing test is as follows. Result starts with "A1," instead of "A,", indicating that the header line is not written.
public class ChoWriterTest
{
[Fact]
public void WriteHeaderAndFields()
{
using var writer = new StringWriter();
using var choWriter = new ChoCSVWriter(writer).WithFirstLineHeader();
choWriter.WriteHeader("A", "B");
choWriter.WriteFields("A1", "B1");
choWriter.WriteFields("A2", "B2");
choWriter.Flush();
writer.Flush();
var result = writer.ToString();
Assert.StartsWith("A,B", result);
}
}
When using WriteFields as a shorthand for writing records without a record object, it seems that no header is written, even though one has been designated. Is this the expected behavior, or should it be consistent with writing records using record objects?
Note that the non-header records are written as expected.
public class ChoWriterTest { [Fact] public void WriteHeaderAndFields() { using var writer = new StringWriter(); using var choWriter = new ChoCSVWriter(writer).WithFirstLineHeader(); choWriter.WriteHeader("A", "B"); choWriter.WriteFields("A1", "B1"); choWriter.WriteFields("A2", "B2"); choWriter.Flush(); writer.Flush(); var result = writer.ToString(); Assert.StartsWith("A,B", result); } }
The text was updated successfully, but these errors were encountered: