Exemplo n.º 1
0
        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)));
        }
Exemplo n.º 2
0
        public void TestFirstWhenThrowingExceptions()
        {
            int[] array = null;

            Func <int, bool> myFunc = (x) => { return(x == 4); };

            Assert.Throws <ArgumentNullException>(() => LINQFunctions.First(array, p => myFunc(p)));
        }
Exemplo n.º 3
0
        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);
        }