public void Test3() { var people = MySelect.GetPeople(); var expected = new List <int>(); expected.Add(34); expected.Add(38); expected.Add(40); Assert.AreEqual(expected, people.HiSelect(person => person.Age * 2)); }
public void Test2() { var people = MySelect.GetPeople(); var expected = new List <int>(); expected.Add(17); expected.Add(19); expected.Add(20); Assert.AreEqual(expected, people.HiSelect(person => person.Age)); }
public void Test4() { var people = MySelect.GetPeople(); var expected = new List <Person>(); var Person1 = new Person(); Person1.Age = 17; Person1.Name = "James"; expected.Add(Person1); var Person2 = new Person(); Person2.Age = 19; Person2.Name = "CC"; expected.Add(Person2); var Person3 = new Person(); Person3.Age = 20; Person3.Name = "Frank"; expected.Add(Person3); var people1 = people.HiSelect(person => new { Age = person.Age, Name = person.Name } ); List <Person> people2 = new List <Person>(); foreach (var item in people1) { var Person4 = new Person(); Person4.Age = item.Age; Person4.Name = item.Name; people2.Add(Person4); } Assert.AreEqual(expected, people2); }