Exemple #1
0
        private static bool HasEligibility(Employee employee, string eligibility)
        {
            var ruleExpression = new RuleExpression <Func <Employee, bool> >();
            var function       = ruleExpression.Function(eligibility);

            var result = function(employee);

            return(result);
        }
        public void TestParameter(string expression, int p1, double p2, double result)
        {
            var jRuleExpression = new RuleExpression <Func <int, decimal, decimal> >();
            var function        = jRuleExpression.Function(expression);

            var result1 = function(p1, (decimal)p2);

            Assert.AreEqual((decimal)result, result1);
        }
Exemple #3
0
        public void TestDecimal(string expression, double result)
        {
            var jRuleExpression = new RuleExpression <Func <decimal> >();
            var function        = jRuleExpression.Function(expression);

            var result1 = function();

            Assert.AreEqual((decimal)result, result1);
        }
Exemple #4
0
        private static decimal CalculatePricing(Employee employee, string pricing)
        {
            var ruleExpression = new RuleExpression <Func <Employee, decimal> >();
            var function       = ruleExpression.Function(pricing);

            var result = function(employee);

            return(result);
        }
Exemple #5
0
        public void TestInt32(string expression, int result)
        {
            var jRuleExpression = new RuleExpression <Func <int> >();
            var function        = jRuleExpression.Function(expression);

            var result1 = function();

            Assert.AreEqual(result, result1);
        }
Exemple #6
0
        public void TestBool(string expression, bool result)
        {
            var jRuleExpression = new RuleExpression <Func <bool> >();
            var function        = jRuleExpression.Function(expression);

            var result1 = function();

            Assert.AreEqual(result, result1);
        }
Exemple #7
0
        public void TestSingle(string expression, float result)
        {
            var jRuleExpression = new RuleExpression <Func <float> >();
            var function        = jRuleExpression.Function(expression);

            var result1 = function();

            Assert.AreEqual(result, result1);
        }
Exemple #8
0
        public void TestString(string expression, string result)
        {
            var jRuleExpression = new RuleExpression <Func <string> >();
            var function        = jRuleExpression.Function(expression);

            var result1 = function();

            Assert.AreEqual(result, result1);
        }
Exemple #9
0
        public void TestParameterVariableDecimal(string expression, double result)
        {
            var employee = new Employee()
            {
                FlexDate = new DateTime(2020, 6, 1), EmployeeNo = "100001", FullName = "张三", BirthDate = new DateTime(1979, 5, 21), FlexSalary = 9690, Category = "EMP", Nationality = "中国", Bool1 = false
            };
            var jRuleExpression = new RuleExpression <Func <Employee, decimal> >();
            var function        = jRuleExpression.Function(expression);

            var result1 = function(employee);

            Assert.AreEqual((decimal)result, result1);
        }