static void Main(string[] args) { var service = new WhateverService(new CsvHelperWrapper<WhateverRow>(), new WhateverRepo()); var stream = service.GetCsvContents(); var memStream = new MemoryStream(); stream.CopyTo(memStream); File.WriteAllBytes("csvhelper.txt", memStream.ToArray()); }
public void WhenProcessingWhatevers() { _stream = new MemoryStream(); _whatevers = new List<WhateverRow>(); _repo = new Mock<IWhateverRepository>(); _repo.Setup(r => r.Get()) .Returns(_whatevers); _csvWrapper = new Mock<ICsvHelperWrapper<WhateverRow>>(); _csvWrapper.Setup(csv => csv.Process(It.IsAny<IList<string>>(), It.IsAny<IList<WhateverRow>>())) .Returns(_stream); var service = new WhateverService(_csvWrapper.Object, _repo.Object); _result = service.GetCsvContents(); }