public void ReadVertexString_For_Vertex_Label(string inputStr) { //Arrange int vNum = -1; string label = null; NetFileVertexTestItem item = new NetFileVertexTestItem(inputStr.Split(new char[] { '#' })); NetFileReader reader = new NetFileReader(); //Act bool result = reader.ReadVertexString(item.RawText, out vNum, out label); //Assert Assert.Equal(item.VertexLabel, label); Assert.True(result); }
//Helpers private IList<NetFileVertexTestItem> ReadVertexTestItems(string dataFile) { IList<NetFileVertexTestItem> items = new List<NetFileVertexTestItem>(); try { NetFileVertexTestItem item = null; using (StreamReader sr = new StreamReader(dataFile)) { string line; while ((line = sr.ReadLine()) != null) { if (line.StartsWith("%")) continue; item = new NetFileVertexTestItem(line.Split(new char[] { '#' })); items.Add(item); } } } catch (Exception e) { // Let the user know what went wrong. Debug.WriteLine(string.Format("The file {0} could not be read: {1}", dataFile, e.Message)); } return items; }