Beispiel #1
0
        public void TestSelectWhenTrowingExceptions()
        {
            List <Employee> employees = null;


            Func <Employee, bool> myFunc = (x) => x.FirstName.StartsWith('P');
            var selectedEmployees        = LINQFunctions.Select(employees, p => myFunc(p));

            Assert.Throws <ArgumentNullException>(() => selectedEmployees.Count());
        }
Beispiel #2
0
        public void TestSelect()
        {
            var employees = Employee.GetEmployees();

            Func <Employee, bool> myFunc = (x) => x.FirstName.StartsWith('P');
            var selectedEmployees        = LINQFunctions.Select(employees, p => myFunc(p));

            int counter = 0;

            foreach (var current in selectedEmployees)
            {
                if (current)
                {
                    counter++;
                }
            }

            Assert.Equal(2, counter);
        }