public void take_while_employee() { var employees = RepositoryFactory.GetEmployees(); var actual = WithoutLinq.CashTakeWhile(employees, 2, a => a.MonthSalary > 150); var expected = new List <Employee>() { new Employee { Name = "Kevin", Role = RoleType.Manager, MonthSalary = 380, Age = 55, WorkingYear = 2.6 }, new Employee { Name = "Bas", Role = RoleType.Engineer, MonthSalary = 280, Age = 36, WorkingYear = 2.6 }, }; expected.ToExpectedObject().ShouldEqual(actual.ToList()); }