Exemplo n.º 1
0
        public void SetItemOutOfRangeTest()
        {
            const int count = 10;

            IPersistentList <int> list = PersistentList <int> .Of(new int[count]);

            Assert.Throws <IndexOutOfRangeException>(() => list.Set(-1, -1));
            Assert.Throws <IndexOutOfRangeException>(() => list.Set(count, -1));
        }
Exemplo n.º 2
0
        public void RemoveOutOfRangeTest()
        {
            const int count = 10;

            IPersistentList <int> list = PersistentList <int> .Of(new int[count]);

            Assert.Throws <IndexOutOfRangeException>(() => list.RemoveAt(-1));
            Assert.Throws <IndexOutOfRangeException>(() => list.RemoveAt(count));
        }
Exemplo n.º 3
0
        public void CreateListTest()
        {
            const int maxLength = 100;

            for (int i = 0; i < maxLength; i++)
            {
                int[] collection = Enumerable.Range(0, i).ToArray();
                CheckListEquality(collection, PersistentList <int> .Of(collection));
                CheckListEquality(collection, PersistentList <int> .OfReadonly(collection));
            }
        }