コード例 #1
0
        public void TestGetValue()
        {
            var lEx = new LiteralExpression("somevalue");

            Assert.Equal("somevalue", lEx.GetValue());
            Assert.Equal("somevalue", lEx.GetValue(typeof(string)));
            var ctx = new StandardEvaluationContext();

            Assert.Equal("somevalue", lEx.GetValue(ctx));
            Assert.Equal("somevalue", lEx.GetValue(ctx, typeof(string)));
            Assert.Equal("somevalue", lEx.GetValue(new Rooty()));
            Assert.Equal("somevalue", lEx.GetValue(new Rooty(), typeof(string)));
            Assert.Equal("somevalue", lEx.GetValue(ctx, new Rooty()));
            Assert.Equal("somevalue", lEx.GetValue(ctx, new Rooty(), typeof(string)));
            Assert.Equal("somevalue", lEx.ExpressionString);
            Assert.False(lEx.IsWritable(new StandardEvaluationContext()));
            Assert.False(lEx.IsWritable(new Rooty()));
            Assert.False(lEx.IsWritable(new StandardEvaluationContext(), new Rooty()));
        }