Пример #1
0
        public void LoadAll_EmptyFile_ReturnEmptyRows(ExcelSettings settings, int rowsNum)
        {
            // arrange
            ExcelDataImport importer = new ExcelDataImport(settings);

            // act
            var rows = importer.LoadAll();

            // assert
            Assert.AreEqual(rowsNum, rows.Count());
        }
Пример #2
0
        public void LoadAll_FileDoesNotExist_ThrowFileNotFoundException(ExcelSettings settings)
        {
            // arrange
            ExcelDataImport importer = new ExcelDataImport(settings);

            // act
            TestDelegate action = () => importer.LoadAll();

            // assert
            Assert.Throws <FileNotFoundException>(action);
        }
Пример #3
0
        public void LoadAll_ValidFile_ReturnRows(ExcelSettings settings, IEnumerable <Row> validRows)
        {
            // arrange
            ExcelDataImport importer = new ExcelDataImport(settings);

            // act
            var rows = importer.LoadAll();

            // assert
            Assert.AreEqual(validRows.Count(), rows.Count());
            var validRowsEnumerator = validRows.GetEnumerator();
            var rowsEnumerator      = rows.GetEnumerator();

            while (validRowsEnumerator.MoveNext() && rowsEnumerator.MoveNext())
            {
                Assert.AreEqual(validRowsEnumerator.Current.Timestamp, rowsEnumerator.Current.Timestamp);
                CollectionAssert.AreEqual(validRowsEnumerator.Current.Samples, rowsEnumerator.Current.Samples);
            }
        }