示例#1
0
 public void GivenUsCensusCSVData_WhenSorting_WhenAnalyseCsvtoJson_ReturnThrowException()
 {
     try
     {
         CensusAnalyser censusAnalyser = new CensusAnalyser(usaFilePath);
         censusAnalyser.LoadUsCencusData();
         JArray sortedData = censusAnalyser.GetSortedCensusData(usaCensusJsonPath, " ", 50);
     }
     catch (CensusAnalyserException e)
     {
         Assert.AreEqual(CensusAnalyserException.ExceptionType.INDEX_NOT_FOUND, e.Type);
     }
 }
示例#2
0
 public void GivenUsCensusCSVData_WhenSorting_WhenAnalyseCsvtoJson_ReturnHighesttotalArea()
 {
     try
     {
         CensusAnalyser censusAnalyser = new CensusAnalyser(usaFilePath);
         censusAnalyser.LoadUsCencusData();
         JArray sortedData = censusAnalyser.GetSortedCensusData(usaCensusJsonPath, "TotalArea", 50);
         Assert.AreEqual("1723338.01", sortedData[50]["TotalArea"].ToString());
     }
     catch (CensusAnalyserException e)
     {
         Assert.AreEqual(CensusAnalyserException.ExceptionType.FILE_NOT_FOUND, e.Type);
     }
 }
示例#3
0
 public void GivenUsCensusCSVData_WhenSorting_WhenAnalyseCsvtoJson_ReturnpopulationDencity()
 {
     try
     {
         CensusAnalyser censusAnalyser = new CensusAnalyser(usaFilePath);
         censusAnalyser.LoadUsCencusData();
         JArray sortedData = censusAnalyser.GetSortedCensusData(usaCensusJsonPath, "PopulationDencity", 0);
         Assert.AreEqual("0.46", sortedData[0]["PopulationDencity"].ToString());
     }
     catch (CensusAnalyserException e)
     {
         Assert.AreEqual(CensusAnalyserException.ExceptionType.FILE_NOT_FOUND, e.Type);
     }
 }
示例#4
0
 public void GivenIndianCensusCSVData_WhenSorting_WhenAnalyseCsvtoJson_ReturnLargetArea()
 {
     try
     {
         CensusAnalyser censusAnalyser = new CensusAnalyser(indiaCensusCsvFilePath);
         censusAnalyser.LoadIndiaCensusData();
         JArray sortedData = censusAnalyser.GetSortedCensusData(indiaStateCensusJsonPath, "AreaInSqKm", 28);
         Assert.AreEqual("342239", sortedData[28]["AreaInSqKm"].ToString());
     }
     catch (CensusAnalyserException e)
     {
         Assert.AreEqual(CensusAnalyserException.ExceptionType.FILE_NOT_FOUND, e.Type);
     }
 }
示例#5
0
 public void GivenIndianCensusCSVData_WhenSorting_WhenAnalyseCsvtoJson_ReturnLowestPopulation()
 {
     try
     {
         CensusAnalyser censusAnalyser = new CensusAnalyser(indiaCensusCsvFilePath);
         censusAnalyser.LoadIndiaCensusData();
         JArray sortedData = censusAnalyser.GetSortedCensusData(indiaStateCensusJsonPath, "Population", 0);
         Assert.AreEqual("607688", sortedData[0]["Population"].ToString());
     }
     catch (CensusAnalyserException e)
     {
         Assert.AreEqual(CensusAnalyserException.ExceptionType.FILE_NOT_FOUND, e.Type);
     }
 }
示例#6
0
 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);
     }
 }