static void Main(string[] args) { // Get data from csv file List <Person> personList = CsvFileUtils.GetPersonDataFromCsv("Resources/data.csv"); if (personList?.Count > 0) { Console.WriteLine("Successfully read csv file"); Console.WriteLine($"Total lines found: { personList.Count}"); // Get name frequency base on firstname and lastname and order by count descending and by name ascending var nameCollection = WordFrequency.GetPersonNamesFrequency(personList); // Get address sorted by name not by number var addressCollection = WordFrequency.GetAddressAlphabatically(personList); // Print data to console window PrintNameFrequencies(nameCollection); PrintAddressFrequencies(addressCollection); // Writing our sorted data and frequency data to csv files WriteToCsv(nameCollection, addressCollection); } else { Console.WriteLine("Total lines found: 0"); } Console.ReadKey(); }
public void TestGetAddressAlphabatically() { var addressSortedList = WordFrequency.GetAddressAlphabatically(PersonList); var addressData1 = addressSortedList[0]; var addressData2 = addressSortedList[1]; Assert.AreEqual(addressData1, "65 Ambling Way"); Assert.AreEqual(addressData2, "102 Long Lane"); }