-Tests
This commit is contained in:
@@ -1694,12 +1694,12 @@ Parameter name: arrayIndex",
|
|||||||
[Test]
|
[Test]
|
||||||
public void GetProperties()
|
public void GetProperties()
|
||||||
{
|
{
|
||||||
JObject o = JObject.Parse("{'prop1':12,'prop2':'hi!'}");
|
JObject o = JObject.Parse("{'prop1':12,'prop2':'hi!','prop3':null,'prop4':[1,2,3]}");
|
||||||
|
|
||||||
ICustomTypeDescriptor descriptor = o;
|
ICustomTypeDescriptor descriptor = o;
|
||||||
|
|
||||||
PropertyDescriptorCollection properties = descriptor.GetProperties();
|
PropertyDescriptorCollection properties = descriptor.GetProperties();
|
||||||
Assert.AreEqual(2, properties.Count);
|
Assert.AreEqual(4, properties.Count);
|
||||||
|
|
||||||
PropertyDescriptor prop1 = properties[0];
|
PropertyDescriptor prop1 = properties[0];
|
||||||
Assert.AreEqual("prop1", prop1.Name);
|
Assert.AreEqual("prop1", prop1.Name);
|
||||||
@@ -1714,6 +1714,20 @@ Parameter name: arrayIndex",
|
|||||||
Assert.AreEqual(typeof(JObject), prop2.ComponentType);
|
Assert.AreEqual(typeof(JObject), prop2.ComponentType);
|
||||||
Assert.AreEqual(false, prop2.CanResetValue(o));
|
Assert.AreEqual(false, prop2.CanResetValue(o));
|
||||||
Assert.AreEqual(false, prop2.ShouldSerializeValue(o));
|
Assert.AreEqual(false, prop2.ShouldSerializeValue(o));
|
||||||
|
|
||||||
|
PropertyDescriptor prop3 = properties[2];
|
||||||
|
Assert.AreEqual("prop3", prop3.Name);
|
||||||
|
Assert.AreEqual(typeof(object), prop3.PropertyType);
|
||||||
|
Assert.AreEqual(typeof(JObject), prop3.ComponentType);
|
||||||
|
Assert.AreEqual(false, prop3.CanResetValue(o));
|
||||||
|
Assert.AreEqual(false, prop3.ShouldSerializeValue(o));
|
||||||
|
|
||||||
|
PropertyDescriptor prop4 = properties[3];
|
||||||
|
Assert.AreEqual("prop4", prop4.Name);
|
||||||
|
Assert.AreEqual(typeof(object), prop4.PropertyType);
|
||||||
|
Assert.AreEqual(typeof(JObject), prop4.ComponentType);
|
||||||
|
Assert.AreEqual(false, prop4.CanResetValue(o));
|
||||||
|
Assert.AreEqual(false, prop4.ShouldSerializeValue(o));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user