public void AffectRankTest() { string[] elements = new string[] { "zero", "un", "deux", "trois", "quatre" }; Enumeratorable<String> instance = new Enumeratorable<String>(); IEnumerable<String> callResult = instance.AffectRank(elements); Assert.IsNotNull(callResult); int index = 0; foreach (String s in callResult) { Assert.IsTrue(s.Contains("[" + index+"]:")); index++; } }
public void DoIEnumerableDemo() { Enumeratorable<Student> holder = new Enumeratorable<Student>(); List<Student> students = new List<Student>(); students.Add(new Student("Alain Lompo", 19.5D)); students.Add(new Student("Khah Trin", 17.5D)); students.Add(new Student("Yeo Man", 18.00D)); IEnumerable<String> rankedStudents = holder.AffectRank(students); foreach (String rankedStudent in rankedStudents) { Console.WriteLine(rankedStudent); } Console.ReadKey(); }