-Added more IBindingList functionality

-Fixed many bugs around JProperty and JObject
-Changed JProperty constructor that doesn't take a value to internal
-Added many unit tests
-Renamed CloneNode to CloseToken
-Changed JPropertyDescriptor to always return the token rather than value
This commit is contained in:
JamesNK
2009-09-04 13:46:47 +00:00
parent 95caaf9dc1
commit 379c3ce09b
15 changed files with 1571 additions and 250 deletions
@@ -55,23 +55,22 @@ namespace Newtonsoft.Json.Tests.Linq.ComponentModel
object value;
value = DataBinder.Eval(o, "First");
value = (string)DataBinder.Eval(o, "First.Value");
Assert.AreEqual(value, (string)o["First"]);
value = DataBinder.Eval(o, "Second");
value = DataBinder.Eval(o, "Second.Value");
Assert.AreEqual(value, (decimal)o["Second"]);
value = DataBinder.Eval(o, "Third");
Assert.AreEqual(value, o["Third"]);
value = DataBinder.Eval(o, "Third[0]");
// urg!
Assert.AreEqual((int)(JToken)value, (int)o["Third"][0]);
value = DataBinder.Eval(o, "Third[0].Value");
Assert.AreEqual((int)value, (int)o["Third"][0]);
value = DataBinder.Eval(o, "Third[5].Fourth");
value = DataBinder.Eval(o, "Third[5].Fourth.Value");
Assert.AreEqual(value, (string)o["Third"][5]["Fourth"]);
value = DataBinder.Eval(o, "Third[5].Fifth.Sixth");
value = DataBinder.Eval(o, "Third[5].Fifth.Sixth.Value");
Assert.AreEqual(value, (string)o["Third"][5]["Fifth"]["Sixth"]);
}
}
@@ -44,7 +44,7 @@ namespace Newtonsoft.Json.Tests.Linq.ComponentModel
JPropertyDescriptor prop1 = new JPropertyDescriptor("prop1", typeof(string));
JPropertyDescriptor prop2 = new JPropertyDescriptor("prop2", typeof(JArray));
Assert.AreEqual("12345!", prop1.GetValue(o));
Assert.AreEqual("12345!", ((JValue) prop1.GetValue(o)).Value);
Assert.AreEqual(o["prop2"], prop2.GetValue(o));
}