コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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());
        }
コード例 #4
0
 public void Init()
 {
     _manager = new Dev2CalculationManager();
     
 }
コード例 #5
0
 public void Init()
 {
     _manager = new Dev2CalculationManager();
 }
コード例 #6
0
        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);
        }
コード例 #7
0
        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());
        }
コード例 #8
0
        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);


        }