public void AddRange_NullItems_ThrowsArgumentNullException() { JsonObject obj = new JsonObject(); Assert.Throws<ArgumentNullException>("items", () => obj.AddRange(null)); Assert.Throws<ArgumentNullException>("items", () => obj.AddRange((IEnumerable<KeyValuePair<string, JsonValue>>)null)); }
public void AddRange_IEnumerable() { KeyValuePair<string, JsonValue>[] items = new KeyValuePair<string, JsonValue>[] { new KeyValuePair<string, JsonValue>("key", new JsonPrimitive(true)) }; JsonObject obj = new JsonObject(); obj.AddRange((IEnumerable<KeyValuePair<string, JsonValue>>)items); Assert.Equal(items.Length, obj.Count); for (int i = 0; i < items.Length; i++) { Assert.Equal(items[i].Value.ToString(), obj[items[i].Key].ToString()); } }