Пример #1
0
        public void GivenStateCodeIncorrectType_ReturnsCustomException()
        {
            CensusAnalyserException Exception = Assert.Throws <CensusAnalyserException>(() => censusAnalyser.LoadCensusData(folderPath + invalidExtensionFileState, "SrNo,State Name,TIN,StateCode"));

            Assert.AreEqual(CensusAnalyserException.ExceptionType.IMPROPER_EXTENSION, Exception.type);
        }
Пример #2
0
        public void GivenStateCodeIncorrectDelimiter_ReturnsCustomException()
        {
            CensusAnalyserException Exception = Assert.Throws <CensusAnalyserException>(() => censusAnalyser.LoadCensusData(folderPath + invalidDelimiterFileStateCode, "SrNo,State Name,TIN,StateCode"));

            Assert.AreEqual(CensusAnalyserException.ExceptionType.DELIMITER_NOT_FOUND, Exception.type);
        }
Пример #3
0
        public void GivenIncorrectHeader_ReturnsCustomException()
        {
            CensusAnalyserException Exception = Assert.Throws <CensusAnalyserException>(() => censusAnalyser.LoadCensusData(folderPath + invalidHeaderState, "State,Population,AreaInSqKm,DensityPerSqKm"));

            Assert.AreEqual(CensusAnalyserException.ExceptionType.INCORRECT_HEADER, Exception.type);
        }
Пример #4
0
        public void GivenStateCodeIncorrectFileName_ReturnsCustomException()
        {
            CensusAnalyserException Exception = Assert.Throws <CensusAnalyserException>(() => censusAnalyser.LoadCensusData(folderPath + validExtensionFileStateCode + "hi", "SrNo, State Name, TIN, StateCode"));

            Assert.AreEqual(CensusAnalyserException.ExceptionType.FILE_NOT_EXISTS, Exception.type);
        }
Пример #5
0
        public void GivenIncorrectType_ReturnsCustomException()
        {
            CensusAnalyserException Exception = Assert.Throws <CensusAnalyserException>(() => censusAnalyser.LoadCensusData(folderPath + invalidExtensionFileState, "State,Population,AreaInSqKm,DensityPerSqKm"));

            Assert.AreEqual(CensusAnalyserException.ExceptionType.IMPROPER_EXTENSION, Exception.type);
        }
Пример #6
0
        public void GivenIncorrectDelimiter_ReturnsCustomException()
        {
            CensusAnalyserException Exception = Assert.Throws <CensusAnalyserException>(() => censusAnalyser.LoadCensusData(folderPath + invalidDelimiterFileState, "State,Population,AreaInSqKm,DensityPerSqKm"));

            Assert.AreEqual(CensusAnalyserException.ExceptionType.DELIMITER_NOT_FOUND, Exception.type);
        }
Пример #7
0
        public void GivenStateCodeIncorrectHeader_ReturnsCustomException()
        {
            CensusAnalyserException Exception = Assert.Throws <CensusAnalyserException>(() => censusAnalyser.LoadCensusData(folderPath + invalidHeaderStateCode, "SrNo,State Name,TIN,StateCode"));

            Assert.AreEqual(CensusAnalyserException.ExceptionType.INCORRECT_HEADER, Exception.type);
        }
Пример #8
0
        public void GivenIncorrectFileName_ReturnsCustomException()
        {
            CensusAnalyserException Exception = Assert.Throws <CensusAnalyserException>(() => censusAnalyser.LoadCensusData(folderPath + validStateCensusFileState + "hi", "State,Population,AreaInSqKm,DensityPerSqKm"));

            Assert.AreEqual(CensusAnalyserException.ExceptionType.FILE_NOT_EXISTS, Exception.type);
        }
Пример #9
0
        public void GivenIncorrectDelimiterAndCSVState_WhenCompiled_ThenReturnsException()
        {
            CensusAnalyserException exception = Assert.ThrowsException <CensusAnalyserException>(() => CSVStates.GetRecord(STATE_CODE_FILE_PATH));

            Assert.AreEqual(CensusAnalyserException.ExceptionType.DELIMITER_INCORRECT, exception.type);
        }
Пример #10
0
        public void GivenInvalidFileHeaderAndCSVState_WhenCompiled_ThenReturnsException()
        {
            CensusAnalyserException exception = Assert.ThrowsException <CensusAnalyserException>(() => CSVStates.GetFileHeader(STATE_CODE_FILE_PATH));

            Assert.AreEqual(CensusAnalyserException.ExceptionType.HEADER_NOT_MATCH, exception.type);
        }
Пример #11
0
        public void GivenIncorrectFileTypeAndCSVState_WhenCompiled_ThenReturnsException()
        {
            CensusAnalyserException exception = Assert.ThrowsException <CensusAnalyserException>(() => CSVStates.GetRecord(WRONG_FILETYPE));

            Assert.AreEqual(CensusAnalyserException.ExceptionType.INCORRECT_FILETYPE, exception.type);
        }
Пример #12
0
        public void GivenIncorrectPathAndCSVState_WhenCompiled_ThenReturnsException()
        {
            CensusAnalyserException exception = Assert.ThrowsException <CensusAnalyserException>(() => CSVStates.WrongPath(FILE_PATH, WRONG_FILEPATH));

            Assert.AreEqual(CensusAnalyserException.ExceptionType.INVALID_FILEPATH, exception.type);
        }
        public void GivenIvalidDelimiterToCSVstateClass_WhenLoaded_ShouldReturnExceptionMessage()
        {
            CensusAnalyserException exception = Assert.Throws <CensusAnalyser.CensusAnalyserException>(() => CSVStateCensus.GetRecordForCsvFile(INDIAN_STATE_CODE));

            Assert.AreEqual(CensusAnalyserException.ExceptionType.DELIMITER_INCORRECT, exception.type);
        }
        public void GivenIvalidFileNameToCSVstateClass_WhenLoaded_ShouldReturnExceptionMessage()
        {
            CensusAnalyserException exception = Assert.Throws <CensusAnalyserException>(() => CSVStateCensus.GetRecordForCsvFile(WRONG_PATH_CSVFILE_NAME));

            Assert.AreEqual(CensusAnalyserException.ExceptionType.INVALID_FILENAME, exception.type);
        }
        public void GivenIvalidPath_WhenLoaded_ShouldReturnExceptionMessage()
        {
            CensusAnalyserException exception = Assert.Throws <CensusAnalyser.CensusAnalyserException>(() => CSVStateCensus.WrongPath(INDIAN_CENSUS_FILEPATH, WRONG_FILEPATH));

            Assert.AreEqual(CensusAnalyserException.ExceptionType.INVALID_FILEPATH, exception.type);
        }