示例#1
0
        public void adding_few_item_sould_work_properly()
        {
            QList <Person> list    = new QList <Person>();
            Person         person1 = PersonHelper.CreateTestPerson();
            Person         person2 = PersonHelper.CreateTestPerson();
            Person         person3 = PersonHelper.CreateTestPerson();
            Person         person4 = PersonHelper.CreateTestPerson();
            Person         person5 = PersonHelper.CreateTestPerson();

            list.Add(person1);
            list.Add(person2);
            list.Add(person3);
            list.Add(person4);
            list.Add(person5);

            Assert.AreEqual(5, list.Count);
            Assert.AreEqual(person1, list[0]);
            Assert.AreEqual(person1, list.FirstOrDefault());


            Assert.AreEqual(person2, list[1]);
            Assert.AreEqual(person3, list[2]);
            Assert.AreEqual(person4, list[3]);

            Assert.AreEqual(person5, list[4]);
            Assert.AreEqual(person5, list.LastOrDefault());
        }