Example #1
0
        public void CSVFileReader_DoubleInitialization()
        {
            FileDataReader reader   = new FileDataReader();
            string         filePath = GetTempFilePath();

            reader.Open(filePath);
            Assert.Throws <InvalidOperationException>(() => reader.Open(GetTempFilePath()));
            reader.Close();
        }
Example #2
0
        public void CSVFileReader_MultipleCleanups()
        {
            FileDataReader reader   = new FileDataReader();
            string         filePath = GetTempFilePath();

            reader.Open(filePath);

            Assert.DoesNotThrow(() => reader.Close());
            Assert.DoesNotThrow(() => reader.Close());
        }
Example #3
0
        public void CSVFileReader_SuccessfulMultipleReads_LessData()
        {
            string filePath = GetTempFilePath();

            WriteData(filePath, "data1");

            FileDataReader reader = new FileDataReader();

            reader.Open(filePath);

            Assert.DoesNotThrow(() => reader.ReadLine());
            Assert.DoesNotThrow(() => reader.ReadLine());
            reader.Close();
        }
Example #4
0
        public void CSVFileReader_SuccessfulRead()
        {
            string filePath = GetTempFilePath();

            WriteData(filePath, "somedata");

            FileDataReader reader = new FileDataReader();

            reader.Open(filePath);

            string dataRead = null;

            Assert.DoesNotThrow(() => dataRead = reader.ReadLine());
            Assert.AreEqual("somedata", dataRead);

            reader.Close();
        }