grrrrinaldi grrrrinaldi - 3 months ago 11
C# Question

Is there a CSV Writer NuGet that uses SystemInterface.IO instead of System.IO?

I started to use CsvHelper by Josh Close, but it uses System.IO.TextWriter, not SystemInterface.IO.
I want to be able to unit test my code without actually creating files.
Does anyone know of a similar helper app that uses SystemInterface.IO?

Thanks!

Answer

Since the CsvHelper classes implement interfaces, you can actually mock those

public class CsvReader : ICsvReader
public class CsvWriter : ICsvWriter
etc.

See: https://github.com/JoshClose/CsvHelper/tree/master/src/CsvHelper

Comments