예제 #1
0
        public void TestReadingCsvFileEofReturnsNull()
        {
            // arrange
            var csvFileReader = new StreamedCSVReader("SampleFile.csv");

            // act
            csvFileReader.ReadLine();
            csvFileReader.ReadLine();
            csvFileReader.ReadLine();

            var result = csvFileReader.ReadLine();

            // assert
            Assert.IsNull(result);
        }
예제 #2
0
        public void TestReadingCsvFileMultipleRows()
        {
            // arrange
            var csvFileReader = new StreamedCSVReader("SampleFile.csv");

            // act
            List <string[]> rows = new List <string[]>();

            rows.Add(csvFileReader.ReadLine());
            rows.Add(csvFileReader.ReadLine());
            rows.Add(csvFileReader.ReadLine());

            // assert
            foreach (var r in rows)
            {
                Assert.IsNotNull(r);
                Assert.IsTrue(r.Length > 0);
                Assert.IsFalse(string.IsNullOrEmpty(string.Join(string.Empty, r)));
            }
        }
예제 #3
0
        public void TestReadingCsvFile()
        {
            // arrange
            var csvFileReader = new StreamedCSVReader("SampleFile.csv");

            // act
            var firstRow = csvFileReader.ReadLine();

            // assert
            Assert.IsNotNull(firstRow);
            Assert.IsTrue(firstRow.Length > 0);
            Assert.IsFalse(string.IsNullOrEmpty(string.Join(string.Empty, firstRow)));
        }