Exemple #1
0
 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));
 }
Exemple #2
0
        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());
        }
Exemple #3
0
 public void Add_NullKey_ThrowsArgumentNullException()
 {
     JsonObject obj = new JsonObject();
     Assert.Throws<ArgumentNullException>("key", () => obj.Add(null, new JsonPrimitive(true)));
 }
Exemple #4
0
        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);
        }