public void TestResults() { string file = System.IO.Path.GetFullPath(@"..\..\..\Data\\data.csv"); if (FileAccess.ValidateFormat(file)) { string error = null; People_Class.ReadAllPeople(file, out error); List <string> expectedFirstNameList = new List <string>(); expectedFirstNameList.AddRange(new string[] { "Iago Tieman", "Cordie Bleibaum", "Shandie Rowles", "Genny Seys", "Renault Millichap", "Shandie Rowles", "Iago Tieman", "Genny Seys", "Iago Tieman" }); List <string> expectedAddressList = new List <string>(); expectedAddressList.AddRange(new string[] { "42 Basil Park", "74584 Moose Parkway", "81075 Killdeer Road", "2 Nova Circle", "32 Butterfield Drive" }); List <string> actualFirstNameList = People_Class.GetFullNameList(); List <string> actualAddressList = People_Class.GetAddressList(); CollectionAssert.AreEqual(expectedFirstNameList, actualFirstNameList); CollectionAssert.AreEqual(expectedAddressList, actualAddressList); } }
//Populate the addresses alphabetically of the items passed from the csv file, populate to grid and ask to open file private void btnAlphabetically_Click(object sender, EventArgs e) { var addresses = Sorter.GetAsendingListIgnoringNumbers(People_Class.GetAddressList()); dataGridView1.DataSource = addresses.Select(x => new { Address = x }).ToList(); string error = null; Helpers.FileAccess.WriteAllLines(_file2, addresses.ToArray(), out error); if (string.IsNullOrEmpty(error)) { if (MessageBox.Show("File generated succesfully, would you like to open the file now?", "Open File", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { Process.Start("notepad.exe", _file2); } } else { toolStripStatusLabel.Text = error; } }