public void CSVReaderWriter_Write_NullWriterOpen() { var csvReaderWriter = new CSVReaderWriter(null, null, delimiter); Assert.Throws <ApplicationException>(() => csvReaderWriter.Open("somedata", Mode.Write)); Assert.Throws <ApplicationException>(() => csvReaderWriter.OpenWrite("somedata")); }
public void CSVReaderWriter_Read_NotOpenedOnWriteOpen() { MockDataReader mockReader = new MockDataReader(); MockDataWriter mockWriter = new MockDataWriter(); mockReader.OpenDelegate = (s) => { Assert.Fail("Open called for reader"); }; var csvReaderWriter = new CSVReaderWriter(mockReader, mockWriter, delimiter); csvReaderWriter.Open("somefilepath", Mode.Write); csvReaderWriter.OpenWrite("somefilepath"); }
public void CSVReaderWriter_Write_Opened() { int openCalled = 0; MockDataWriter mockWriter = new MockDataWriter(); mockWriter.OpenDelegate = (s) => { Assert.AreEqual("somefilepath", s); openCalled++; }; var csvReaderWriter = new CSVReaderWriter(null, mockWriter, delimiter); csvReaderWriter.Open("somefilepath", Mode.Write); csvReaderWriter.OpenWrite("somefilepath"); Assert.AreEqual(2, openCalled); }