public void FoldTest() { List <int> list = new List <int> { 1, 2, 3 }; int newValue = Fold.FoldFunction(list, 1, (acc, elem) => acc * elem); int expectedValue = 6; Assert.AreEqual(newValue, expectedValue); }
/// <summary> /// The entry point of the program /// </summary> /// <param name="args"></param> public static void Main(string[] args) { Fold fold = new Fold(); Console.WriteLine(fold.FoldFunction(new List<int>() { 1, 2, 3 }, 1, (acc, elem) => acc * elem)); }
public void FoldFunctionTest() { Fold fold = new Fold(); int value = fold.FoldFunction(new List<int>() { 1, 2, 3, 4, 5 }, 2, (acc, elem) => acc * elem); Assert.AreEqual(value, 240); }