public void Add_NullKeyInKeyValuePair_ThrowsArgumentNullException() { JsonObject obj = new JsonObject(); KeyValuePair<string, JsonValue> item = new KeyValuePair<string, JsonValue>(null, new JsonPrimitive(true)); Assert.Throws<ArgumentNullException>("key", () => obj.Add(item)); }
public void Add() { JsonObject obj = new JsonObject(); KeyValuePair<string, JsonValue> item = new KeyValuePair<string, JsonValue>("key", new JsonPrimitive(true)); obj.Add(item); Assert.Equal(1, obj.Count); Assert.Equal(item.Key, obj.Keys.First()); Assert.Equal(item.Value.ToString(), obj.Values.First().ToString()); }
public void Add_NullKey_ThrowsArgumentNullException() { JsonObject obj = new JsonObject(); Assert.Throws<ArgumentNullException>("key", () => obj.Add(null, new JsonPrimitive(true))); }
public void prop_Count_get() { var document = new JsonObject(); Assert.Equal(0, document.Count); document.Add(new JsonPair("name", "value")); Assert.Equal(1, document.Count); }