public void TestFunctionPairPermutation() { int[] intArray = { 1, 2, 3, 4, 5 }; int[,] result = new int[intArray.Length, intArray.Length]; try { result = Miscellaneous <int> .FunctionPairPermutation( intArray, (x, y) => { //Console.WriteLine("{0}+{1}={2}", x, y, (x + y)); return(x + y); }); } finally { for (int i = 0; i < result.GetLength(0); i++) { for (int j = 0; j < result.GetLength(1); j++) { //Console.WriteLine("result [{0}][{1}]= {2}", i,j,result[i,j]); int expected = intArray[i] + intArray[j]; Assert.AreEqual <int>(expected, result[i, j]); } } } }