예제 #1
0
        public void ImportWrongClassThrowsException()
        {
            //Arrange
            var import = new ImportCSV("SchoolTest.csv");

            //Act and Assert
            var ex = Assert.ThrowsException <ArgumentException>(() => import.getDataFromCSV <BlankClass>());

            Assert.AreEqual("Model name does not exist", ex.Message);
        }
예제 #2
0
        public void ImportSchoolResultData()
        {
            //Arrange
            var import = new ImportCSV("SchoolResultTest.csv");

            //Act
            var data = import.getDataFromCSV <SchoolResult>();

            //Assert
            Assert.AreEqual(_data["SchoolResultTest"].Count(), data.Count());
        }
예제 #3
0
        public void ImportSchoolDataExcludesFieldsNotInMap()
        {
            //Arrange
            var import = new ImportCSV("SchoolTestExtraFields.csv");

            //Act
            var data = import.getDataFromCSV <School>();

            //Assert
            Assert.AreEqual(_data["SchoolTestExtraFields"].Count(), data.Count());
        }
예제 #4
0
        public void ImportSchoolDataWithNullRecords()
        {
            //Arrange
            var import = new ImportCSV("SchoolTestNullRecords.csv");

            //Act
            var data = import.getDataFromCSV <School>();

            //Assert
            Assert.AreEqual(_data["SchoolTestNullRecords"].Count(), data.Count());
        }
예제 #5
0
        public void ImportSchoolContextualDataIncludesNATData()
        {
            //Arrange
            var import = new ImportCSV("SchoolContextualTestNAT.csv");

            //Act
            var data = import.getDataFromCSV <SchoolContextual>();

            //Assert
            Assert.AreEqual(_data["SchoolContextualTestNAT"].Count(), data.Count());
        }
예제 #6
0
        public void FileDoesNotExistException()
        {
            //Arrange
            var import = new ImportCSV("FileDoesNotExist.csv");


            //Act and Assert
            var ex = Assert.ThrowsException <FileNotFoundException>(() => import.getDataFromCSV <School>());

            Assert.AreEqual("CSV file does not exist", ex.Message);
        }
예제 #7
0
        public void ImportSchoolResultIgnoreRecordsWithAllNullResults()
        {
            //Arrange
            var import = new ImportCSV("SchoolResultTestAllNullRecords.csv");

            //Act
            var data = import.getDataFromCSV <SchoolResult>();

            //Assert
            Assert.AreEqual(_data["SchoolResultTestAllNullRecords"].Count() - 1, data.Count());
        }
예제 #8
0
        public void ImportSchoolDataIgnoreRowsWithTwoOrLessFields()
        {
            //Arrange
            var import = new ImportCSV("SchoolTestDifferentRowLength.csv");

            //Act
            var data = import.getDataFromCSV <School>();

            //Assert

            //Checks the data omits the 1 row that has only 2 fields
            Assert.AreEqual(_data["SchoolTestDifferentRowLength"].Count() - 1, data.Count());
        }