public void TestGenericMixedInserts()
        {
            MyLinkedList <ClubMember> list = new MyLinkedList <ClubMember>();

            list.Insert(p3);             // p3
            list.Append(p22);            // p3,p22
            list.Insert(p9);             // p9,p3,p22
            list.Insert(p1);             // p1,p9,p3,p22
            list.Append(p24);            // p1,p9,p3,p22,p24
            list.Insert(p5);             // p5,p1,p9,p3,p22,p24
            list.Append(p16);            // p5,p1,p9,p3,p22,p24,p16

            Assert.AreEqual(p5, list.First);
            Assert.AreEqual(p16, list.Last);
            Assert.AreEqual(7, list.Count);

            Assert.AreEqual(p5, list.ItemAt(0));
            Assert.AreEqual(p1, list.ItemAt(1));
            Assert.AreEqual(p9, list.ItemAt(2));
            Assert.AreEqual(p3, list.ItemAt(3));
            Assert.AreEqual(p22, list.ItemAt(4));
            Assert.AreEqual(p24, list.ItemAt(5));
            Assert.AreEqual(p16, list.ItemAt(6));
        }
        public void TestSortClubMembersAfterGenderAndLastName()
        {
            MyLinkedList <ClubMember> list = new MyLinkedList <ClubMember>();

            list.Insert(p2);  // Gender : Male,   LastName : Quail
            list.Insert(p4);  // Gender : Female, LastName : Mish
            list.Insert(p23); // Gender : Male,   LastName : Sarrell
            list.Insert(p9);  // Gender : Female, LastName : Foulsham
            list.Insert(p5);  // Gender : Male,   LastName : Boustred
            list.Insert(p19); // Gender : Male,   LastName : Filler
            list.Insert(p13); // Gender : Female, LastName : Ansley

            list.Sort(new ClubMember.SortClubMembersAfterGenderAndLastName());

            Assert.AreEqual(p5, list.ItemAt(0));  // Gender : Male,   LastName : Boustred
            Assert.AreEqual(p19, list.ItemAt(1)); // Gender : Male,   LastName : Filler
            Assert.AreEqual(p2, list.ItemAt(2));  // Gender : Male,   LastName : Quail
            Assert.AreEqual(p23, list.ItemAt(3)); // Gender : Male,   LastName : Sarrell
            Assert.AreEqual(p13, list.ItemAt(4)); // Gender : Female, LastName : Ansley
            Assert.AreEqual(p9, list.ItemAt(5));  // Gender : Female, LastName : Foulsham
            Assert.AreEqual(p4, list.ItemAt(6));  // Gender : Female, LastName : Mish
        }
        public void TestBubbleSortInt()
        {
            MyLinkedList <int> list = new MyLinkedList <int>();

            list.Insert(55);              // 55
            list.Insert(78);              // 78, 55
            list.Insert(23);              // 23, 78, 55
            list.Insert(88);              // 88, 23, 78, 55
            list.Insert(62);              // 62, 88, 23, 78, 55
            list.Insert(49);              // 49, 62, 88, 23, 78, 55

            list.Sort();

            Assert.AreEqual(23, list.ItemAt(0));
            Assert.AreEqual(49, list.ItemAt(1));
            Assert.AreEqual(55, list.ItemAt(2));
            Assert.AreEqual(62, list.ItemAt(3));
            Assert.AreEqual(78, list.ItemAt(4));
            Assert.AreEqual(88, list.ItemAt(5));
        }
        public void TestBubbleSortClubMember()
        {
            MyLinkedList <ClubMember> list = new MyLinkedList <ClubMember>();

            list.Insert(p4);  // p4
            list.Insert(p9);  // p9, p4
            list.Insert(p5);  // p5, p9, p4
            list.Insert(p19); // p19, p5, p9, p4
            list.Insert(p23); // p23, p19, p5, p9, p4
            list.Insert(p2);  // p2, p23, p19, p5, p9, p4

            list.Sort();      // Sort on FirstName

            Assert.AreEqual(p19, list.ItemAt(0));
            Assert.AreEqual(p4, list.ItemAt(1));
            Assert.AreEqual(p5, list.ItemAt(2));
            Assert.AreEqual(p9, list.ItemAt(3));
            Assert.AreEqual(p23, list.ItemAt(4));
            Assert.AreEqual(p2, list.ItemAt(5));
        }
        public void TestSortClubMembersAfterLastName()
        {
            MyLinkedList <ClubMember> list = new MyLinkedList <ClubMember>();

            list.Insert(p2);  // LastName : Quail
            list.Insert(p4);  // LastName : Mish
            list.Insert(p23); // LastName : Sarrell
            list.Insert(p9);  // LastName : Foulsham
            list.Insert(p5);  // LastName : Boustred
            list.Insert(p19); // LastName : Filler


            list.Sort(new ClubMember.SortClubMembersAfterLastName()); // Sort on LastName

            Assert.AreEqual(p5, list.ItemAt(0));                      // LastName : Boustred
            Assert.AreEqual(p19, list.ItemAt(1));                     // LastName : Filler
            Assert.AreEqual(p9, list.ItemAt(2));                      // LastName : Foulsham
            Assert.AreEqual(p4, list.ItemAt(3));                      // LastName : Mish
            Assert.AreEqual(p2, list.ItemAt(4));                      // LastName : Quail
            Assert.AreEqual(p23, list.ItemAt(5));                     // LastName : Sarrell
        }