void AssertValues(params Tuple <string, string>[] functions) { foreach (var function in functions) { Assert.AreEqual(function.Item1, _manager.CalculateFormula(function.Item2).ToString(CultureInfo.InvariantCulture).ToLower()); } }
public void CreateCustomFunction_AllValidValues_Expected_CustomFunctionCreatedAndRegisteredWithCalcManager() { const string functionName = "TestFunction"; List <string> arguments = new List <string> { "x", "y" }; List <string> argumentDescriptions = new List <string> { "the first argument", "the second argument" }; const string description = "My TestFunction"; IFunction func = MathOpsFactory.CreateFunction(functionName, arguments, argumentDescriptions, description); IDev2CalculationManager manager = new Dev2CalculationManager(); Func <double[], double> function = AddAbs; func.CreateCustomFunction(functionName, arguments, argumentDescriptions, description, function, manager); CalculationValue value = manager.CalculateFormula("TestFunction(1)"); Assert.AreEqual(123123423423, value.ToDouble()); }
public void CreateCustomFunction_AllValidValues_Expected_CustomFunctionCreatedAndRegisteredWithCalcManager() { const string functionName = "TestFunction"; List<string> arguments = new List<string> { "x", "y" }; List<string> argumentDescriptions = new List<string> { "the first argument", "the second argument" }; const string description = "My TestFunction"; IFunction func = MathOpsFactory.CreateFunction(functionName, arguments, argumentDescriptions, description); IDev2CalculationManager manager = new Dev2CalculationManager(); Func<double[], double> function = AddAbs; func.CreateCustomFunction(functionName, arguments, argumentDescriptions, description, function, manager); CalculationValue value = manager.CalculateFormula("TestFunction(1)"); Assert.AreEqual(123123423423, value.ToDouble()); }