public void TestFirstWhenDoesntExists() { var array = new int[] { 2, 5, 3 }; Func <int, bool> myFunc = (x) => { return(x == 4); }; Assert.Throws <InvalidOperationException>(() => LINQFunctions.First(array, p => myFunc(p))); }
public void TestFirstWhenThrowingExceptions() { int[] array = null; Func <int, bool> myFunc = (x) => { return(x == 4); }; Assert.Throws <ArgumentNullException>(() => LINQFunctions.First(array, p => myFunc(p))); }
public void TestFirstWhenExists() { var array = new int[] { 2, 4, 3 }; Func <int, bool> myFunc = (x) => { return(x == 4); }; var result = LINQFunctions.First(array, p => myFunc(p)); Assert.Equal(4, result); }