示例#1
0
 public void ContainsKey_NullKey_ThrowsArgumentNullException()
 {
     JsonObject obj = new JsonObject();
     Assert.Throws<ArgumentNullException>("key", () => obj.ContainsKey(null));
 }
示例#2
0
        public void ICollection_Remove()
        {
            KeyValuePair<string, JsonValue> item = new KeyValuePair<string, JsonValue>("key", new JsonPrimitive(true));
            JsonObject obj = new JsonObject(item);
            ICollection<KeyValuePair<string, JsonValue>> iCollection = obj;

            iCollection.Remove(item);
            Assert.Equal(0, obj.Count);
            Assert.False(obj.ContainsKey(item.Key));

            iCollection.Remove(item);
            Assert.Equal(0, obj.Count);
        }
示例#3
0
        public void ContainsKey()
        {
            KeyValuePair<string, JsonValue> item = new KeyValuePair<string, JsonValue>("key", new JsonPrimitive(true));
            JsonObject obj = new JsonObject(item);

            Assert.True(obj.ContainsKey(item.Key));
            Assert.False(obj.ContainsKey("abc"));

            ICollection<KeyValuePair<string, JsonValue>> iCollection = obj;
            Assert.True(iCollection.Contains(item));
            Assert.False(iCollection.Contains(new KeyValuePair<string, JsonValue>()));
        }