public static int USCensusRecords(string usCensus)
        {
            //check file type
            bool type = CSVOperations.CheckFileType(usCensus, ".csv");

            string[] records = CSVOperations.ReadCSVFile(usCensus);
            //check for Number of Records
            int count = CSVOperations.CountRecords(records);

            return(count);
        }
예제 #2
0
        /// <summary>
        ///Method to find Number of records in file for StateCode csv file
        /// </summary>
        /// <param name="stateCode"> State Code data path </param>
        /// <param name="delimiter"> Delimiter </param>
        /// <param name="header"> Header </param>
        /// <returns> Data count,delimiter,header </returns>
        public static int GetDataFromCSVFile(string stateCode, char delimiter = ',', string header = "SrNo,State,TIN,StateCode")
        {
            //check file type
            bool type = CSVOperations.CheckFileType(stateCode, ".csv");

            string[] records = CSVOperations.ReadCSVFile(stateCode);
            //check for delimiter
            bool delimit = CSVOperations.CheckForDelimiter(records, delimiter);
            //check for delimiter
            bool head = CSVOperations.CheckForHeader(records, header);
            //check for Number of Records
            int count = CSVOperations.CountRecords(records);

            return(count);
        }
        public static int NumberOfRecords(string filePath, char delimiter = ',', string header = "State,Population,AreaInSqKm,DensityPerSqKm")
        {
            //check for filetype
            bool type = CSVOperations.CheckFileType(filePath, ".csv");

            string[] records = CSVOperations.ReadCSVFile(filePath);
            //check for delimiter
            bool delimit = CSVOperations.CheckForDelimiter(records, delimiter);
            //check for Header
            bool head = CSVOperations.CheckForHeader(records, header);
            //check for Number of Records
            int count = CSVOperations.CountRecords(records);

            return(count);
        }
예제 #4
0
        public void GiventheStatesCensusCSVfile_WhenAnalyse_ShouldRecordNumberOfRecordmatches()
        {
            int actual = CSVOperations.NumberOfRecords(IndianCensusdata);

            Assert.AreEqual(29, actual);
        }
예제 #5
0
        public void GivenCSVStateCodeFile_WhenAnalyse_ShouldRecordNumberOfRecordmatcheStateCode()
        {
            int actual = CSVOperations.NumberOfRecords(Statecode);

            Assert.AreEqual(37, actual);
        }