public virtual void RemoveAt(int index)
        {
            var value = ValueList[index];

            ValueList.RemoveAt(index);
            PairList.RemoveAt(index);

            base.Remove(value);
        }
        public override void Remove(T value)
        {
            var index = IndexOf(value);

            ValueList.RemoveAt(index);
            PairList.RemoveAt(index);

            base.Remove(value);
        }
        public override void Remove(string key)
        {
            var index = IndexOf(Collection[key]);

            ValueList.RemoveAt(index);
            PairList.RemoveAt(index);

            base.Remove(key);
        }
        public virtual void MoveValue(int newIndex, int currentIndex)
        {
            var value = ValueList[currentIndex];
            var pair  = PairList[currentIndex];

            ValueList.RemoveAt(currentIndex);
            PairList.RemoveAt(currentIndex);
            ValueList.Insert(newIndex, value);
            PairList.Insert(newIndex, pair);
        }
Ejemplo n.º 5
0
        public void Remove()
        {
            List <int> oracle = new List <int>()
            {
                1, 2, 45, 100, 42, 5000
            };
            var l = new ValueList <int>(oracle);

            l.RemoveAt(3);
            oracle.RemoveAt(3);
            CheckEqualElements <int>(l, oracle);
        }
Ejemplo n.º 6
0
        public static void RemoveAtTest()
        {
            var valueList = new ValueList <int>(new int[] { 1, 2, 3 });

            valueList.RemoveAt(0);

            Assert.That(() => valueList,
                        Has.Property("Capacity").EqualTo(3)
                        .And.Count.EqualTo(2)
                        );

            Assert.That(() => valueList[0],
                        Is.EqualTo(2)
                        );

            Assert.That(() => valueList[1],
                        Is.EqualTo(3)
                        );

            Assert.That(() => valueList.RemoveAt(-1),
                        Throws.InstanceOf <ArgumentOutOfRangeException>()
                        .And.Property("ActualValue").EqualTo(-1)
                        .And.Property("ParamName").EqualTo("index")
                        );

            Assert.That(() => valueList.RemoveAt(2),
                        Throws.InstanceOf <ArgumentOutOfRangeException>()
                        .And.Property("ActualValue").EqualTo(2)
                        .And.Property("ParamName").EqualTo("index")
                        );

            valueList = new ValueList <int>();

            Assert.That(() => valueList.RemoveAt(0),
                        Throws.InstanceOf <ArgumentOutOfRangeException>()
                        .And.Property("ActualValue").EqualTo(0)
                        .And.Property("ParamName").EqualTo("index")
                        );
        }