public void WhereWhenNotEmpty() { var numbers = new[] { 1, 2, 3 }; var numbersGreaterThanOne = MyEnumerable.Where(numbers, (n, i) => i > 0); Assert.That(numbersGreaterThanOne, Is.EquivalentTo(new[] { 2, 3 })); }
public void WhereWhenEmpty() { var numbers = new List <Int32>(); var allNumbers = MyEnumerable.Where(numbers, (n, i) => i >= 0); Assert.That(allNumbers, Is.Empty); }
public void WhereWhenEmpty() { var numbers = new List <Int32>(); var numbersGreaterThanFive = MyEnumerable.Where(numbers, n => n > 5); Assert.That(numbersGreaterThanFive, Is.Empty); }
private static void UseMyEnumerable() { var e = new MyEnumerable(); var q2 = e.Where(x => x % 2 == 0); var q3 = q2.Select(x => x * x); foreach (var val in q3) { Console.WriteLine($"{val}"); } }
public void ThrowsWhenPredicateIsNull() { IEnumerable <Int32> source = new[] { 1, 2, 3 }; Assert.Throws <ArgumentNullException>(() => MyEnumerable.Where(source, (Func <Int32, Int32, Boolean>)null)); }
public void ThrowsWhenSourceIsNull() { IEnumerable <Int32> source = null; Assert.Throws <ArgumentNullException>(() => MyEnumerable.Where(source, (n, i) => i > 0)); }