Exemple #1
0
        public void inserting_sould_work_properly()
        {
            QList <Person> list = new QList <Person>();

            Int32 count = 100;

            for (var i = 0; i < count; i++)
            {
                list.Add(PersonHelper.CreateTestPerson());
            }

            Person firstPerson = PersonHelper.CreateTestPerson();

            list.Insert(0, firstPerson);

            Person lastPerson = PersonHelper.CreateTestPerson();

            list.Insert(list.Count, lastPerson);

            Person middlePerson = PersonHelper.CreateTestPerson();

            list.Insert(50, middlePerson);

            Assert.IsTrue(list.IndexOf(firstPerson) >= 0);
            Assert.IsTrue(list.IndexOf(lastPerson) >= 0);
            Assert.IsTrue(list.IndexOf(middlePerson) >= 0);
            Assert.AreEqual(count + 3, list.Items.Count());
        }