示例#1
0
        public void TestNullNullableExpression()
        {
            MyNullableInt = null;

            var binding = new ExpressionBind(this, $"MyNullableInt");

            Assert.AreEqual(null, (int?)binding.Result);
        }
示例#2
0
        public void TestAutoNestedExpression()
        {
            var host = new TestClass(new TestClass(new TestClass(null, 41), 6), 5);

            var binding = new ExpressionBind(host, $"(Child.TestInt + Child.Child.TestInt) * TestInt");

            Assert.AreEqual((6 + 41) * 5, (int)binding.Result);
            host.Child.TestInt++;
            Assert.AreEqual((7 + 41) * 5, (int)binding.Result);
        }
示例#3
0
        public void TestAutoExpression()
        {
            var host    = new TestClass(null, 5);
            var binding = new ExpressionBind(host, "TestInt * 2");

            Assert.AreEqual(10, (int)binding.Result);

            host.TestInt++;
            Assert.AreEqual(12, (int)binding.Result);
        }