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); }
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); }
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); }
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); }
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); }
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); }