示例#1
0
        public void CopyTo(int arrayIndex)
        {
            KeyValuePair<string, JsonValue>[] items = new KeyValuePair<string, JsonValue>[] { new KeyValuePair<string, JsonValue>("key", new JsonPrimitive(true)) };
            JsonObject array = new JsonObject(items);
            KeyValuePair<string, JsonValue>[] copy = new KeyValuePair<string, JsonValue>[array.Count + arrayIndex];
            array.CopyTo(copy, arrayIndex);

            for (int i = 0; i < arrayIndex; i++)
            {
                Assert.Equal(default(KeyValuePair<string, JsonValue>), copy[i]);
            }
            for (int i = arrayIndex; i < copy.Length; i++)
            {
                Assert.Equal(items[i - arrayIndex], copy[i]);
            }
        }