예제 #1
0
        public void DefaultRuntimeTypeForMetaObjectValueType()
        {
            Expression        exp = Expression.Default(typeof(ValueTypeOnlyKnownHere));
            NopDynamicObject  nop = new NopDynamicObject();
            DynamicMetaObject dmo = nop.GetMetaObject(exp);

            Assert.Same(typeof(ValueTypeOnlyKnownHere), dmo.RuntimeType);
            Assert.Same(typeof(ValueTypeOnlyKnownHere), dmo.LimitType);
        }
예제 #2
0
        public void MetaObjectNullExpression()
        {
            NopDynamicObject nop = new NopDynamicObject();

            // Ideally the name returned should be "parameter" to match that on GetMetaObject
            // but the only way to change this without making other calls incorrect and without
            // a breaking change to names would be to catch and rethrow, which is more expensive
            // than it's worth.
            Assert.Throws <ArgumentNullException>("expression", () => nop.GetMetaObject(null));
        }
예제 #3
0
        public void DefaultPropertiesForMetaObject()
        {
            Expression        exp = Expression.Default(typeof(TypeOnlyKnownHere));
            NopDynamicObject  nop = new NopDynamicObject();
            DynamicMetaObject dmo = nop.GetMetaObject(exp);

            Assert.Same(nop, dmo.Value);
            Assert.Same(exp, dmo.Expression);
            Assert.True(dmo.HasValue);
            Assert.Same(BindingRestrictions.Empty, dmo.Restrictions);
        }
        public void MetaObjectNullExpression()
        {
            NopDynamicObject nop = new NopDynamicObject();

            // Ideally the name returned should be "parameter" to match that on GetMetaObject
            // but the only way to change this without making other calls incorrect and without
            // a breaking change to names would be to catch and rethrow, which is more expensive
            // than it's worth.
            Assert.Throws<ArgumentNullException>("expression", () => nop.GetMetaObject(null));
        }
 public void DefaultRuntimeTypeForMetaObjectValueType()
 {
     Expression exp = Expression.Default(typeof(ValueTypeOnlyKnownHere));
     NopDynamicObject nop = new NopDynamicObject();
     DynamicMetaObject dmo = nop.GetMetaObject(exp);
     Assert.Same(typeof(ValueTypeOnlyKnownHere), dmo.RuntimeType);
     Assert.Same(typeof(ValueTypeOnlyKnownHere), dmo.LimitType);
 }
 public void DefaultPropertiesForMetaObject()
 {
     Expression exp = Expression.Default(typeof(TypeOnlyKnownHere));
     NopDynamicObject nop = new NopDynamicObject();
     DynamicMetaObject dmo = nop.GetMetaObject(exp);
     Assert.Same(nop, dmo.Value);
     Assert.Same(exp, dmo.Expression);
     Assert.True(dmo.HasValue);
     Assert.Same(BindingRestrictions.Empty, dmo.Restrictions);
 }