Пример #1
0
        public void Insert_InvalidIndex_ThrowsArgumentOutOfRangeException()
        {
            JsonArray array = new JsonArray(new JsonPrimitive(true));

            Assert.Throws<ArgumentOutOfRangeException>("index", () => array.Insert(-1, new JsonPrimitive(false)));
            Assert.Throws<ArgumentOutOfRangeException>("index", () => array.Insert(2, new JsonPrimitive(false)));
        }
Пример #2
0
        public void Insert()
        {
            JsonArray array = new JsonArray(new JsonPrimitive(true));
            JsonPrimitive value = new JsonPrimitive(false);
            array.Insert(1, value);

            Assert.Equal(2, array.Count);
            Assert.Same(value, array[1]);
        }