public void GivenUSCensusDataAndAddToJsonPathAndSorting_ReturnFirstState()
        {
            string expected  = "Alabama";
            string lastValue = JSONCensus.SortCsvFileWriteInJsonAndReturnFirstData(USDataPath, usDataPathJSON, "State");

            Assert.AreEqual(expected, lastValue);
        }
        public void GivenCsvUSCensusAndJson_ToSortFromLeastPopulousToMost_ReturnLeastPopulation()
        {
            string expected        = "563626";
            string leastPopulation = JSONCensus.ReturnDataNumberOfStatesSortLowestCSVFileAndWriteInJson(USDataPath, usDataPathJSON, "Population");

            Assert.AreEqual(expected, leastPopulation);
        }
        public void GivenCsvUSCensusAndJson_ToSortFromMostTotalAreaToLeast_ReturnMostTotalArea()
        {
            string expected      = "1723338.01";
            string mostTotalArea = JSONCensus.ReturnDataNumberOfStatesHighestSortCSVFileAndWriteInJson(USDataPath, usDataPathJSON, "Total area");

            Assert.AreEqual(expected, mostTotalArea);
        }
        public void GivenStateCensusDataAndAddToJsonPathAndSortFromMostAreaInSqKmToLeast_ShouldReturnAreaInSqKmv()
        {
            string expected         = "342239";
            string mostDensityPerKm = JSONCensus.ReturnDataNumberOfStatesHighestSortCSVFileAndWriteInJson(stateCensusPath, stateCensusDataPathJSON, "AreaInSqKm");

            Assert.AreEqual(expected, mostDensityPerKm);
        }
Example #5
0
        public void GivenSmallestStateByArea_WhenSortedByAreaPerKm_ShouldReturnsSmallestStateArea()
        {
            string expected          = "3702";
            string smallestStateArea = JSONCensus.ReturnDataNumberOfStatesSortLowestCSVFileAndWriteInJson(stateCensusPath, jsonPathstateCensus, "AreaInSqKm");

            Assert.AreEqual(expected, smallestStateArea);
        }
        public void GivenCsvUSCensusAndJson_ToSortFromLeastTotalAreaToMost_ReturnLeastTotalArea()
        {
            string expected      = "177";
            string mostTotalArea = JSONCensus.ReturnDataNumberOfStatesSortLowestCSVFileAndWriteInJson(USDataPath, jsonPathUSData, "Total area");

            Assert.AreEqual(expected, mostTotalArea);
        }
        public void GivenCsvUSCensusAndJson_ToSortFromLeastPopulousDEnsityToMost_ReturnLeastPopulationDensity()
        {
            string expected = "0.46";
            string leastPopulationDensity = JSONCensus.ReturnDataNumberOfStatesSortLowestCSVFileAndWriteInJson(USDataPath, jsonPathUSData, "Population Density");

            Assert.AreEqual(expected, leastPopulationDensity);
        }
        public void GivenCsvUSCensusAndJson_ToSortFromMostPopulousToLeast_ReturnMostPolulation()
        {
            string expected    = "37253956";
            string mostPopulus = JSONCensus.ReturnDataNumberOfStatesHighestSortCSVFileAndWriteInJson(USDataPath, jsonPathUSData, "Population");

            Assert.AreEqual(expected, mostPopulus);
        }
        public void GivenStateCensusDataAndAddToJsonPathAndSortFromLeastDensityPerKmMost_ShouldReturnDensityPerSqKm()
        {
            string expected         = "50";
            string mostDensityPerKm = JSONCensus.ReturnDataNumberOfStatesSortLowestCSVFileAndWriteInJson(stateCensusPath, stateCensusDataPathJSON, "DensityPerSqKm");

            Assert.AreEqual(expected, mostDensityPerKm);
        }
        public void CheckUSCensusDataAndAddToJsonPathAndSorting_ReturnLastState()
        {
            string expected  = "Wyoming";
            string lastValue = JSONCensus.SortCsvFileWriteInJsonAndReturnLastData(USDataPath, jsonPathUSData, "State");

            Assert.AreEqual(expected, lastValue);
        }
Example #11
0
        public void GivenLeastPopulationDensityPerKm_WhenSorted_ShouldReturnsLeastDensityPerKm()
        {
            string expected          = "52";
            string leastDensityPerKm = JSONCensus.ReturnDataNumberOfStatesSortLowestCSVFileAndWriteInJson(stateCensusPath, jsonPathstateCensus, "DensityPerSqKm");

            Assert.AreEqual(expected, leastDensityPerKm);
        }
Example #12
0
        public void GivenLargestStateByArea_WhenSortedByAreaPerKm_ShouldReturnsLargestStateArea()
        {
            string expected         = "342239";
            string largestStateArea = JSONCensus.ReturnDataNumberOfStatesHighestSortCSVFileAndWriteInJson(stateCensusPath, jsonPathstateCensus, "AreaInSqKm");

            Assert.AreEqual(expected, largestStateArea);
        }
Example #13
0
        public void GivenMostPopulationDensityPerKm_WhenSorted_ShouldReturnsMostDensityPerSqKm()
        {
            string expected         = "1102";
            string mostDensityPerKm = JSONCensus.ReturnDataNumberOfStatesHighestSortCSVFileAndWriteInJson(stateCensusPath, jsonPathstateCensus, "DensityPerSqKm");

            Assert.AreEqual(expected, mostDensityPerKm);
        }
Example #14
0
        public void GivenMostPopulousState_WhenSorted_ShouldReturnsTheNumberOfStates()
        {
            string expected       = "199812341";
            string mostPopulation = JSONCensus.ReturnDataNumberOfStatesHighestSortCSVFileAndWriteInJson(stateCensusPath, jsonPathstateCensus, "Population");

            Assert.AreEqual(expected, mostPopulation);
        }
Example #15
0
        public void GivenStateCensusDataAndAddToJsonPathAndSorting_WhenSorted_ShouldReturnsFirstStateCode()
        {
            string expected  = "AD";
            string lastValue = JSONCensus.SortCsvFileWriteInJsonAndReturnFirstData(stateCodePath, jsonPathStateCode, "StateCode");

            Assert.AreEqual(expected, lastValue);
        }
Example #16
0
        public void GivenStateCensusDataAndAddToJsonPathAndSorting_WhenSorted__ShouldReturnLastStateWB()
        {
            string expected  = "West Bengal";
            string lastValue = JSONCensus.SortCsvFileWriteInJsonAndReturnLastData(stateCensusDataPath, jsonPathstateCensus, "State");

            Assert.AreEqual(expected, lastValue);
        }
        public void GivenCsvUSCensusAndJson_ToSortFromMostPopulousDensityToLeast_ReturnMostPopulationDensity()
        {
            string expected = "3805.61";
            string mostPopulationDensity = JSONCensus.ReturnDataNumberOfStatesHighestSortCSVFileAndWriteInJson(USDataPath, jsonPathUSData, "Population Density");

            Assert.AreEqual(expected, mostPopulationDensity);
        }
        public void GivenStateCensusDataAndAddToJsonPathAndSortFromMostLeastToPopulous_ShouldReturnTotalSortedStates()
        {
            string expected       = "607688";
            string mostPopulation = JSONCensus.ReturnDataNumberOfStatesSortLowestCSVFileAndWriteInJson(stateCensusPath, stateCensusDataPathJSON, "Population");

            Assert.AreEqual(expected, mostPopulation);
        }
        public void CheckStateCensusDataAndAddToJsonPathAndSortFromMostDensityPerKmLeast_ReturnMostDensityPerSqKm()
        {
            string expected         = "1102";
            string mostDensityPerKm = JSONCensus.ReturnDataNumberOfStatesHighestSortCSVFileAndWriteInJson(stateCensusPath, jsonPathstateCensus, "DensityPerSqKm");

            Assert.AreEqual(expected, mostDensityPerKm);
        }
        public void CheckStateCensusDataAndAddToJsonPathAndSortFromLeastAreaInSqKmToMost_ReturnLeastAreaInSqKmv()
        {
            string expected         = "3242";
            string mostDensityPerKm = JSONCensus.ReturnDataNumberOfStatesSortLowestCSVFileAndWriteInJson(stateCensusPath, jsonPathstateCensus, "AreaInSqKm");

            Assert.AreEqual(expected, mostDensityPerKm);
        }
        public void CheckStateCensusDataAndAddToJsonPathAndSortFromLeastToPopulousToMost_ReturnLeastPopulation()
        {
            string expected        = "607688";
            string leastPopulation = JSONCensus.ReturnDataNumberOfStatesSortLowestCSVFileAndWriteInJson(stateCensusPath, jsonPathstateCensus, "Population");

            Assert.AreEqual(expected, leastPopulation);
        }
        public void CheckStateCensusDataAndAddToJsonPathAndSortFromMostPopulousToLeast_ReturnMostPopulation()
        {
            string expected       = "199812341";
            string mostPopulation = JSONCensus.ReturnDataNumberOfStatesHighestSortCSVFileAndWriteInJson(stateCensusPath, jsonPathstateCensus, "Population");

            Assert.AreEqual(expected, mostPopulation);
        }
        public void CheckStateCensusDataAndAddToJsonPathAndSorting_ReturnLatStateCode()
        {
            string expected  = "WB";
            string lastValue = JSONCensus.SortCsvFileWriteInJsonAndReturnLastData(stateCodePath, jsonPathstateCode, "StateCode");

            Assert.AreEqual(expected, lastValue);
        }
        public void CheckStateCensusDataAndAddToJsonPathAndSorting_ReturnFirstState()
        {
            string expected  = "Andhra Pradesh";
            string lastValue = JSONCensus.SortCsvFileWriteInJsonAndReturnFirstData(stateCensusPath, jsonPathstateCensus, "State");

            Assert.AreEqual(expected, lastValue);
        }
Example #25
0
 public void GivenWrongCSVAndJsonDataToAddIntoJSon_AfterSortingOnPopulationDensity_WhenAnalyse_ReturnException()
 {
     try
     {
         Assert.Throws <CensusAnalyzerException>(() => JSONCensus.SortCSVFileOnNumbersAndWriteInJsonAndReturnData(Csv_Census_File_Path, USCensus_Json_File_Path, "Population Density"));
     }
     catch (CensusAnalyzerException)
     {
         throw new CensusAnalyzerException(CensusAnalyzerException.ExceptionType.Invalid_Census_Data, "Invalid Census Data");
     }
 }
Example #26
0
 public void GivenWrongStateCodeFile_AfterSorting_WhenAnalyse_ShouldReturnException()
 {
     try
     {
         Assert.Throws <CensusAnalyzerException>(() => JSONCensus.SortCSVFileWriteInJsonAndReturnFirstData(Csv_Census_File_Path, StateCode_Json_File_Path, "StateCode"));
     }
     catch (CensusAnalyzerException)
     {
         throw new CensusAnalyzerException(CensusAnalyzerException.ExceptionType.Invalid_Census_Data, "Invalid Census Data");
     }
 }
Example #27
0
 public void GivenCSVAndJsonPathToAddIntoJSon_AfterSorting_WhenAnalyse_ReturnException()
 {
     try
     {
         Assert.Throws <CensusAnalyzerException>(() => JSONCensus.SortCSVFileWriteInJsonAndReturnFirstData(Csv_Census_File_Path, StateCensus_Json_File_Path, "Datta"));
     }
     catch (CensusAnalyzerException)
     {
         throw new CensusAnalyzerException(CensusAnalyzerException.ExceptionType.Invalid_Census_Data, "Invalid Census Data");
     }
 }
 public void GivenCsvStateCensusAndJson_ToSortFromMostPopulousToLeast_ReturnTheNumberOfSatetesSorted()
 {
     try
     {
         string expected   = "199812341";
         string population = JSONCensus.ReturnDataNumberOfStatesSortCSVFileAndWriteInJson(STATE_CENSUS_CSV_FILE_PATH, JSON_PATH_STATE_CENSUS, "Population");
         Assert.AreEqual(expected, population);
     }
     catch (CensusAnalyserException exception)
     {
         throw new CensusAnalyserException(exception.Message, CensusAnalyserException.Exception_type.File_Not_Found);
     }
 }
 public void GivenCsvUsCensusAndJson_ToSortFromMostPopulousAreaToLeast_ReturnTheNumberOfSatetesSorted()
 {
     try
     {
         string expected = "1723338.01";
         string area     = JSONCensus.ReturnDataNumberOfStatesSortCSVFileAndWriteInJson(US_CENSUS_DATA_FILE_PATH, JSON_PATH_STATE_CENSUS, "Total area");
         Assert.AreEqual(expected, area);
     }
     catch (CensusAnalyserException exception)
     {
         throw new CensusAnalyserException(exception.Message, CensusAnalyserException.Exception_type.File_Not_Found);
     }
 }
 public void GivenCSVAndJsonPathToAddIntoJSon_AfterSortingOnArea_ReturnlastState()
 {
     try
     {
         string expected   = "3702";
         string firstValue = JSONCensus.ReturnDataNumberOfStatesFirstDataSortCSVFileAndWriteInJson(STATE_CENSUS_CSV_FILE_PATH, JSON_PATH_STATE_CENSUS, "AreaInSqKm");
         Assert.AreEqual(expected, firstValue);
     }
     catch (CensusAnalyserException exception)
     {
         throw new CensusAnalyserException(exception.Message, CensusAnalyserException.Exception_type.File_Not_Found);
     }
 }