public void Should_Read_Line_Successfully_When_File_Is_Read() { //Arrange _csvReader = Substitute.For <ICSVReader>(); _csvWriter = Substitute.For <ICSVWriter>(); _csvReaderWriter = new CSVReaderWriter(_csvReader, _csvWriter); //Act _csvReaderWriter.Open(FilePath, CSVReaderWriter.Mode.Read); _csvReaderWriter.Read(Name, Address); //Assert _csvReader.Received().Read(Name, Address); }
public void Should_Open_Reader_When_Mode_Is_Read() { //Arrange _csvReader = Substitute.For <ICSVReader>(); _csvWriter = Substitute.For <ICSVWriter>(); _csvReaderWriter = new CSVReaderWriter(_csvReader, _csvWriter); //Act _csvReaderWriter.Open(FilePath, CSVReaderWriter.Mode.Read); //Assert _csvReader.Received().Open(FilePath); _csvWriter.DidNotReceive().Open(FilePath); }
public void Should_Dispose_Resources_When_Closed() { //Arrange _csvReader = Substitute.For <ICSVReader>(); _csvWriter = Substitute.For <ICSVWriter>(); _csvReaderWriter = new CSVReaderWriter(_csvReader, _csvWriter); //Act _csvReaderWriter.Open(FilePath, CSVReaderWriter.Mode.Read); _csvReaderWriter.Close(); //Assert _csvReader.Received().Dispose(); _csvWriter.Received().Dispose(); }