public void ReadFileTest() { string expected = "Item Code"; var textFileHandle = new TextFileHandle(); var fileContents = textFileHandle.GetFileContents(); string[] row = fileContents[0]; string actual = row[0]; Assert.AreEqual(expected, actual); }
/* Loads the DataGridView with contents from the stoclist.csv * file. * fileContents is a list of string arrayscontaining the data * from the text file. Each string array of the list contaisn the * four fields of the column*/ public void LoadDataGridVew(DataGridView dataGridView) { dataGridView.Rows.Clear(); var textFileHandle = new TextFileHandle(); var fileContents = textFileHandle.GetFileContents(); for (int i = 1; i < fileContents.Count; i++) { string[] column = fileContents[i]; dataGridView.Rows.Add("0", column[0], column[1], Convert.ToInt32(column[2]), column[3]); } }