Beispiel #1
0
        public void CannotCopyToViaGenericCollectionWithTooSmallArray()
        {
            ICollection <KeyValuePair <string, object> > obj = new JsonObject();

            obj.Add(new KeyValuePair <string, object>("foo", "bar"));
            obj.CopyTo(new KeyValuePair <string, object> [1], 1);
        }
Beispiel #2
0
        public void CopyToViaGenericCollection()
        {
            ICollection <KeyValuePair <string, object> > obj = new JsonObject();
            KeyValuePair <string, object> first = new KeyValuePair <string, object>("first", 123);

            obj.Add(first);
            KeyValuePair <string, object> second = new KeyValuePair <string, object>("second", 456);

            obj.Add(second);
            KeyValuePair <string, object>[] pairs = new KeyValuePair <string, object> [2];
            obj.CopyTo(pairs, 0);
            Assert.AreEqual(first, pairs[0]);
            Assert.AreEqual(second, pairs[1]);
        }
Beispiel #3
0
 public void CopyToViaGenericCollection()
 {
     ICollection<KeyValuePair<string, object>> obj = new JsonObject();
     KeyValuePair<string, object> first = new KeyValuePair<string, object>("first", 123);
     obj.Add(first);
     KeyValuePair<string, object> second = new KeyValuePair<string, object>("second", 456);
     obj.Add(second);
     KeyValuePair<string, object>[] pairs = new KeyValuePair<string, object>[2];
     obj.CopyTo(pairs, 0);
     Assert.AreEqual(first, pairs[0]);
     Assert.AreEqual(second, pairs[1]);
 }
Beispiel #4
0
 public void CannotCopyToViaGenericCollectionWithTooSmallArray()
 {
     ICollection<KeyValuePair<string, object>> obj = new JsonObject();
     obj.Add(new KeyValuePair<string, object>("foo", "bar"));
     obj.CopyTo(new KeyValuePair<string, object>[1], 1);
 }
Beispiel #5
0
 public void CannotCopyToViaGenericCollectionWithNullArray()
 {
     ICollection<KeyValuePair<string, object>> obj = new JsonObject();
     obj.CopyTo(null, 0);
 }
Beispiel #6
0
 public void CannotCopyToViaGenericCollectionWithNegativeArrayIndex()
 {
     ICollection<KeyValuePair<string, object>> obj = new JsonObject();
     obj.CopyTo(new KeyValuePair<string, object>[0], -1);
 }
Beispiel #7
0
        public void CannotCopyToViaGenericCollectionWithNegativeArrayIndex()
        {
            ICollection <KeyValuePair <string, object> > obj = new JsonObject();

            obj.CopyTo(new KeyValuePair <string, object> [0], -1);
        }
Beispiel #8
0
        public void CannotCopyToViaGenericCollectionWithNullArray()
        {
            ICollection <KeyValuePair <string, object> > obj = new JsonObject();

            obj.CopyTo(null, 0);
        }