Exemple #1
0
        public void TestAggregateExceptions()
        {
            int[] array = null;
            Func <int, int, int> myFunc = (x, z) => x * z;

            Assert.Throws <ArgumentNullException>(() => LinqFunctions.Aggregate(array, 5, (a, b) => myFunc(a, b)));
        }
Exemple #2
0
        public void TestAggregateWhenValid()
        {
            int[] array = { 1, 2, 4, 5 };

            Func <int, int, int> myFunc = (x, z) => x * z;

            var result = LinqFunctions.Aggregate(array, 5, (a, b) => myFunc(a, b));

            Assert.Equal(200, result);
        }