예제 #1
0
        public async Task LoadCompanyStaticDataAsConstantAsync(IStaticDataRepository staticDataRepo)
        {
            var remarks = await staticDataRepo.LoadRemarkAsync();

            foreach (Remark remark in remarks)
            {
                mcalcEnggine.AddConstant(remark.Code, remark.Value);
            }
        }
예제 #2
0
        public void TestFormulaBuilderConstantCompiled()
        {
            CalculationEngine engine = new CalculationEngine(CultureInfo.InvariantCulture, ExecutionMode.Compiled);

            engine.AddConstant("age", 18.0);

            Func <int, double> function = (Func <int, double>)engine.Formula("age+var1")
                                          .Parameter("var1", DataType.Integer)
                                          .Result(DataType.FloatingPoint)
                                          .Build();

            double result = function(3);

            Assert.AreEqual(21.0, result);
        }
예제 #3
0
 private static void AddTrueFalseConstanta(CalculationEngine calculator)
 {
     calculator.AddConstant("true", 1);
     calculator.AddConstant("false", 0);
 }