public void GivenCensusCSVFileAndCSVState_WhenNumberOfRecordMatch_ThenItShouldReturnTrue() { int CSVStateRecord = CSVStates.GetRecord(FILE_PATH); int StateCensusRecord = StateCensusAnalyser.GetStateCensusRecord(STATE_CODE_FILE_PATH); Assert.AreEqual(CSVStateRecord, StateCensusRecord); }
public void GivenCSVSTateCodeFile_WhenHeadersDoNotMatch_ShouldThrowCustomException() { string filePath = @"E:\CodinClub\Assignments_Fellowship\Indian-State-Census-Analyzer-Problem\StateCensusAnalyser\StateCensusAnalyser\IndiaStateCensusData.csv"; var exception = Assert.Throws <StateCensusAnalyserException>(() => CSVStates.HeaderException(filePath)); Assert.AreEqual(StateCensusAnalyserException.ExceptionType.HEADERS_MISSMATCH, exception.type); }
public void GivenCSVStateCodeFile_WhenIncorrectDelimiter_ShouldThrowCustomException() { string filePath = @"E:\CodinClub\Assignments_Fellowship\Indian-State-Census-Analyzer-Problem\StateCensusAnalyser\StateCensusAnalyser\IndiaStateCode.csv"; var exception = Assert.Throws <StateCensusAnalyserException>(() => CSVStates.checkDelimiters(filePath)); Assert.AreEqual(StateCensusAnalyserException.ExceptionType.DELIMITER_INCORRECT, exception.type); }
public void GivenCSVStateCodeFile_WhenNumberOfRecordsMatches_ShoulReturnTrue() { string filePath = @"E:\CodinClub\Assignments_Fellowship\Indian-State-Census-Analyzer-Problem\StateCensusAnalyser\StateCensusAnalyser\IndiaStateCode.csv"; int CSVRecords = CSVStates.GetRecords(filePath); int records = StateCensusAnalyser.StateCodeAnalyser.GetStateCodeRecords(filePath); Assert.AreEqual(CSVRecords, records); }
public void GivenCSVStateCodeFilePath_WhenIncorrect_ShouldThrowCustomException() { try { string filePath = @"C:\Assignments_Fellowship\Indian-State-Census-Analyzer-Problem\StateCensusAnalyser\StateCensusAnalyser\IndiaStateCode.csv"; int CSVRecords = CSVStates.GetRecords(filePath); int records = StateCensusAnalyser.StateCodeAnalyser.GetStateCodeRecords(filePath); Assert.AreEqual(CSVRecords, records); } catch (StateCensusAnalyserException e) { Assert.AreEqual(StateCensusAnalyserException.ExceptionType.INVALID_PATH, e.type); } }
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); }
public void GivenIncorrectDelimiterAndCSVState_WhenCompiled_ThenReturnsException() { CensusAnalyserException exception = Assert.ThrowsException <CensusAnalyserException>(() => CSVStates.GetRecord(STATE_CODE_FILE_PATH)); Assert.AreEqual(CensusAnalyserException.ExceptionType.DELIMITER_INCORRECT, exception.type); }
public void GivenIncorrectFileTypeAndCSVState_WhenCompiled_ThenReturnsException() { CensusAnalyserException exception = Assert.ThrowsException <CensusAnalyserException>(() => CSVStates.GetRecord(WRONG_FILETYPE)); Assert.AreEqual(CensusAnalyserException.ExceptionType.INCORRECT_FILETYPE, exception.type); }
public void GivenIncorrectPathAndCSVState_WhenCompiled_ThenReturnsException() { CensusAnalyserException exception = Assert.ThrowsException <CensusAnalyserException>(() => CSVStates.WrongPath(FILE_PATH, WRONG_FILEPATH)); Assert.AreEqual(CensusAnalyserException.ExceptionType.INVALID_FILEPATH, exception.type); }