public static int USCensusRecords(string uscensus)
 {
     try
     {
         bool     type    = CSVOperations.CheckFileType(uscensus, ".csv");
         string[] records = CSVOperations.ReadCSVFile(uscensus);
         int      count   = CSVOperations.CountRecords(records);
         return(count);
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#2
0
 /// <summary>
 ///Method to find Number of records in file for StateCode csv file
 /// </summary>
 public static int getDataFromCSVFile(string statecode, char delimiter = ',', string header = "SrNo,State,TIN,StateCode")
 {
     try
     {
         bool     type    = CSVOperations.CheckFileType(statecode, ".csv");
         string[] records = CSVOperations.ReadCSVFile(statecode);
         bool     delimit = CSVOperations.CheckForDelimiter(records, delimiter);
         bool     head    = CSVOperations.CheckForHeader(records, header);
         int      count   = CSVOperations.CountRecords(records);
         return(count);
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#3
0
 public static int NumberOfRecords(string filepath, char delimiter = ',', string header = "State,Population,AreaInSqKm,DensityPerSqKm")
 {
     try
     {
         bool     type    = CSVOperations.CheckFileType(filepath, ".csv");
         string[] records = CSVOperations.ReadCSVFile(filepath);
         bool     del     = CSVOperations.CheckForDelimiter(records, delimiter);
         bool     head    = CSVOperations.CheckForHeader(records, header);
         int      count   = CSVOperations.CountRecords(records);
         return(count);
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#4
0
        public void GivenCSVStateCodeFile_WhenAnalyse_ShouldRecordNumberOfRecordmatcheStateCode()
        {
            int actual = CSVOperations.NumberOfRecords(Csv_StateCode_File_Path);

            Assert.AreEqual(37, actual);
        }
示例#5
0
        public void GiventheStatesCensusCSVfile_WhenAnalyse_ShouldRecordNumberOfRecordmatches()
        {
            int actual = CSVOperations.NumberOfRecords(Csv_Census_File_Path);

            Assert.AreEqual(29, actual);
        }