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; } }
/// <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; } }
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; } }
public void GivenCSVStateCodeFile_WhenAnalyse_ShouldRecordNumberOfRecordmatcheStateCode() { int actual = CSVOperations.NumberOfRecords(Csv_StateCode_File_Path); Assert.AreEqual(37, actual); }
public void GiventheStatesCensusCSVfile_WhenAnalyse_ShouldRecordNumberOfRecordmatches() { int actual = CSVOperations.NumberOfRecords(Csv_Census_File_Path); Assert.AreEqual(29, actual); }