Ejemplo n.º 1
0
        public void Local()
        {
            var    valueType = ValueType.Local;
            object property  = "this";
            object model     = new { Name = "Ben" };

            IModelValueProvider modelValueProvider = new ExpandoObjectModelValueProvider();
            object result = modelValueProvider.GetValue(model, valueType, property);

            Assert.AreEqual(model, result);
        }
Ejemplo n.º 2
0
        public void Keyword()
        {
            var    valueType = ValueType.Keyword;
            object property  = false;
            object model     = null;

            IModelValueProvider modelValueProvider = new ExpandoObjectModelValueProvider();
            object result = modelValueProvider.GetValue(model, valueType, property);

            Assert.AreEqual(property, result);
        }
Ejemplo n.º 3
0
        public void Local()
        {
            var valueType = ValueType.Local;
            object property = "this";
            object model = new { Name = "Ben" };

            IModelValueProvider modelValueProvider = new ExpandoObjectModelValueProvider();
            object result = modelValueProvider.GetValue(model, valueType, property);

            Assert.AreEqual(model, result);
        }
Ejemplo n.º 4
0
        public void Keyword()
        {
            var valueType = ValueType.Keyword;
            object property = false;
            object model = null;

            IModelValueProvider modelValueProvider = new ExpandoObjectModelValueProvider();
            object result = modelValueProvider.GetValue(model, valueType, property);

            Assert.AreEqual(property, result);
        }
Ejemplo n.º 5
0
        public void ExpandoObjectStringLiteral()
        {
            var valueType = ValueType.StringLiteral;
            dynamic property = "this is a string literal";
            object model = null;

            IModelValueProvider modelValueProvider = new ExpandoObjectModelValueProvider();
            object result = modelValueProvider.GetValue(model, valueType, property);
            Assert.IsInstanceOf<string>(result);
            Assert.AreEqual(property, result as string);
        }
Ejemplo n.º 6
0
        public void ExpandoObjectStringLiteral()
        {
            var     valueType = ValueType.StringLiteral;
            dynamic property  = "this is a string literal";
            object  model     = null;

            IModelValueProvider modelValueProvider = new ExpandoObjectModelValueProvider();
            object result = modelValueProvider.GetValue(model, valueType, property);

            Assert.IsInstanceOf <string>(result);
            Assert.AreEqual(property, result as string);
        }
Ejemplo n.º 7
0
        public void Property()
        {
            var     valueType = ValueType.Property;
            object  property  = "Name";
            dynamic model     = new ExpandoObject();

            model.Name = new ExpandoObject();
            model.Name = "Ben";

            IModelValueProvider modelValueProvider = new ExpandoObjectModelValueProvider();
            object result = modelValueProvider.GetValue(model, valueType, property);

            Assert.AreEqual("Ben", result);
        }
Ejemplo n.º 8
0
        public void NestedProperty()
        {
            var valueType = ValueType.Property;
            object property = "Name.FirstName";
            dynamic model = new ExpandoObject();
            model.Name = new ExpandoObject();
            model.Name.FirstName = "Ben";
            model.Name.LastName = "Dornis";

            IModelValueProvider modelValueProvider = new ExpandoObjectModelValueProvider();
            object result = modelValueProvider.GetValue(model, valueType, property);

            Assert.AreEqual("Ben", result);
        }