-Added set indexer to JToken

This commit is contained in:
JamesNK
2009-09-18 21:38:50 +00:00
parent 379c3ce09b
commit fac4f481b3
8 changed files with 150 additions and 0 deletions
@@ -44,5 +44,26 @@ namespace Newtonsoft.Json.Tests.Linq
i++;
}
}
[Test]
[ExpectedException(typeof(ArgumentException), ExpectedMessage = @"Set JConstructor values with invalid key value: ""badvalue"". Argument position index expected.")]
public void SetValueWithInvalidIndex()
{
JConstructor c = new JConstructor();
c["badvalue"] = new JValue(3);
}
[Test]
public void SetValue()
{
object key = 0;
JConstructor c = new JConstructor();
c.Name = "con";
c.Add(null);
c[key] = new JValue(3);
Assert.AreEqual(3, (int)c[key]);
}
}
}