示例#1
0
 public void givenUSCensusAndIndianCensusToAnalyze_WhenToSort_ShouldReturnSortedResult()
 {
     CSVObj.LoadData(US_CENSUS_CSV_PATH, CustomEnums.TYPE.USCENSUS);
     CSVObj.LoadData(INDIAN_CENSUS_CSV_PATH, CustomEnums.TYPE.INDIASTATECENSUS);
     CustomEnums.TYPE[] arr        = new CustomEnums.TYPE[] { CustomEnums.TYPE.USCENSUS, CustomEnums.TYPE.INDIASTATECENSUS };
     USCensusDTO[]      sortedList = CSVObj.SortData <USCensusDTO>(CustomEnums.FIELDS.POPULATION, arr, CustomEnums.sort.DESCENDING, CustomEnums.FIELDS.DENSITY);
     Assert.AreEqual("Uttar Pradesh", sortedList[0].state);
     Assert.AreEqual("Wyoming", sortedList[sortedList.Length - 1].state);
 }
示例#2
0
        /// <summary>
        /// Loads the data.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="type">The type.</param>
        /// <returns>String array of CSV data</returns>
        public Dictionary <string, List <CensusDAO> > LoadData(string path, CustomEnums.TYPE type)
        {
            string className = GetDescription(type);

            string[] data    = factory.GetCSVLoader().LoadData(path, className);
            Adaptor  adaptor = new Adaptor();

            return(adaptor.LoadCSV(data, className));
        }
示例#3
0
        /// <summary>
        /// Gets the count of given type of Country data.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="type">The type.</param>
        /// <returns>Count of data</returns>
        public int GetCount(string path, CustomEnums.TYPE type)
        {
            string className = GetDescription(type);

            return(LoadData(path, type)[className].Count);
        }