Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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();
        }