Esempio n. 1
0
        public void RemoveAt()
        {
            var cut          = new SortedBindingList <Data>();
            var raisedEvents = new List <ListChangedEventArgs>();

            cut.ListChanged += (s, e) => raisedEvents.Add(e);

            var datas = AddData(cut, 3);

            const int at = 1;

            cut.RemoveAt(at);
            var last = raisedEvents.Last();

            Assert.AreEqual(datas.Length - 1, cut.Count);
            for (int i = 0, j = 0; i < datas.Length; i++)
            {
                if (i == at)
                {
                    continue;
                }
                Assert.AreEqual(datas[i], cut[j]);
                j++;
            }
            Assert.AreEqual(ListChangedType.ItemDeleted, last.ListChangedType);
            Assert.AreEqual(at, last.NewIndex);
        }