public void GivenIndianStateCode_WhenIncorrectHeader_ShouldThrowCustomException() { try { CensusAnalyser censusAnalyser = new CensusAnalyser(indiaStateCodePath); censusAnalyser.LoadIndiaStateCode(); } catch (CensusAnalyserException e) { Assert.AreEqual(CensusAnalyserException.ExceptionType.HEADER_INCORRECT, e.Type); } }
public void GivenIndiaStateCode_WhenDelimeterIncorrect_shouldThrowCustomException() { try { CensusAnalyser censusAnalyser = new CensusAnalyser(indiaStateCodePath); censusAnalyser.LoadIndiaStateCode(); } catch (CensusAnalyserException e) { Assert.AreEqual(CensusAnalyserException.ExceptionType.DELIMETER_INCORRECT_EXCEPTION, e.Type); } }
public void GivenIndianStateCode_WhenWrongExtension_shouldThrowCustomException() { try { CensusAnalyser censusAnalyser = new CensusAnalyser(wrongStateCodeFileExtension); censusAnalyser.LoadIndiaStateCode(); } catch (CensusAnalyserException e) { Assert.AreEqual(CensusAnalyserException.ExceptionType.UNEXPECTED_ERROR, e.Type); } }
public void GivenIndianStateCode_WhenPassNull_shouldThrowCustomException() { try { CensusAnalyser censusAnalyser = new CensusAnalyser(null); censusAnalyser.LoadIndiaStateCode(); } catch (CensusAnalyserException e) { Assert.AreEqual(CensusAnalyserException.ExceptionType.FILE_NOT_FOUND, e.Type); } }
public void GivenIndiaStateCodeData_WhenPassEmptyString_shouldThrowCustomException() { try { CensusAnalyser censusAnalyser = new CensusAnalyser(" "); censusAnalyser.LoadIndiaStateCode(); } catch (CensusAnalyserException e) { Assert.AreEqual(CensusAnalyserException.ExceptionType.UNEXPECTED_ERROR, e.Type); } }
public void GivenIndianStateCode_CSVFile_ShouldReturnsCorrectRecords() { try { CensusAnalyser censusAnalyser = new CensusAnalyser(indiaStateCodePath); int csvstateData = censusAnalyser.LoadIndiaStateCode(); Assert.AreEqual(37, csvstateData); } catch (CensusAnalyserException e) { Assert.AreEqual(CensusAnalyserException.ExceptionType.FILE_NOT_FOUND, e.Type); } }
public void GivenIndianStateCodeCSVData_WhenSorting_WhenAnalyseCsvtoJson_ReturnLastState() { try { CensusAnalyser censusAnalyser = new CensusAnalyser(indiaStateCodePath); censusAnalyser.LoadIndiaStateCode(); JArray sortedData = censusAnalyser.GetSortedCensusData(indianStateCodeJsonPath, "State", 36); Assert.AreEqual("West Bengal", sortedData[36]["State"].ToString()); } catch (CensusAnalyserException e) { Assert.AreEqual(CensusAnalyserException.ExceptionType.FILE_NOT_FOUND, e.Type); } }