public static List<Employee> Load(System.IO.StreamReader stream) { List<Employee> list = new List<Employee>(); try { while (stream.Peek() >= 0) { string line = stream.ReadLine(); string[] values = line.Split(','); Employee employee = new Employee(); employee.FirstName = values[0]; employee.LastName = values[1]; employee.Email = values[2]; list.Add(employee); } } catch (Exception) { throw; } finally { stream.Close(); } return list; }
public void SetUp() { string path = @".\ch19\ex02\Employee.txt"; Encoding encode = Encoding.GetEncoding("Shift_JIS"); stream = new System.IO.StreamReader(path, encode); expected = new Employee(); expected.FirstName = "Ichiro"; expected.LastName = "Tanaka"; expected.Email = "*****@*****.**"; }
public static NUnit.Framework.Constraints.Constraint Employee(Employee expected) { return new EmployeeConstraint(expected); }
public EmployeeConstraint(Employee expected) { this.expected = expected; }