public void CreateCustomFunction_NullArgumentDescription_Expected_ExceptionReturned() { const string functionName = "TestFunction"; List <string> arguments = new List <string> { "x", "y" }; const string description = "My TestFunction"; IFunction func = MathOpsFactory.CreateFunction(functionName, arguments, null, description); IDev2CalculationManager manager = new Dev2CalculationManager(); func.CreateCustomFunction(functionName, arguments, null, description, null, manager); Assert.AreNotEqual(null, func.ArgumentDescriptions); }
public void CreateCustomFunction_NullFunc_Expected_ExceptionReturned() { const string functionName = "TestFunction"; var arguments = new List <string> { "x", "y" }; var argumentDescriptions = new List <string> { "the first argument", "the second argument" }; const string description = "My TestFunction"; var func = MathOpsFactory.CreateFunction(functionName, arguments, argumentDescriptions, description); IDev2CalculationManager manager = new Dev2CalculationManager(); func.CreateCustomFunction(functionName, arguments, argumentDescriptions, description, null, manager); Assert.AreEqual("TestFunction", func.FunctionName); }
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 Init() { _manager = new Dev2CalculationManager(); }
public void CreateCustomFunction_NullArgumentDescription_Expected_ExceptionReturned() { const string functionName = "TestFunction"; List<string> arguments = new List<string> { "x", "y" }; const string description = "My TestFunction"; IFunction func = MathOpsFactory.CreateFunction(functionName, arguments, null, description); IDev2CalculationManager manager = new Dev2CalculationManager(); func.CreateCustomFunction(functionName, arguments, null, description, null, manager); Assert.AreNotEqual(null, func.ArgumentDescriptions); }
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_NullFunc_Expected_ExceptionReturned() { string functionName = "TestFunction"; List<string> arguments = new List<string> { "x", "y" }; List<string> argumentDescriptions = new List<string> { "the first argument", "the second argument" }; string description = "My TestFunction"; IFunction func = MathOpsFactory.CreateFunction(functionName, arguments, argumentDescriptions, description); IDev2CalculationManager manager = new Dev2CalculationManager(); Func<double[], double> function = null; func.CreateCustomFunction(functionName, arguments, argumentDescriptions, description, function, manager); Assert.AreEqual("TestFunction", func.FunctionName); }