示例#1
0
        public void kidRemoveTest()
        {
            kidListBox kids_list_box = new kidListBox();
            kid        turki         = new kid("turki/1720");
            kid        chris         = new kid("chris/1920");

            kids_list_box.add(turki);
            kids_list_box.add(chris);
            //checks item at index 0
            kids_list_box.SetItemChecked(0, true);
            kids_list_box.deleteChecked();

            foreach (kid each in kids_list_box.getSet())
            {
                Assert.AreNotEqual("turki", each.getName());
            }
        }
示例#2
0
        public void editAlreadyExisitingKidTest()
        {
            // add two kids to the list
            kidListBox kid_list_box = new kidListBox();
            kid        child1       = new kid("Simon Owens", "Lincoln Ave");
            kid        child2       = new kid("Don Roberts/Heaven Ave");

            kid_list_box.add(child1);
            kid_list_box.add(child2);

            // edit one to what the other kid already is
            kid_list_box.edit(child1, "Don Roberts", "Heaven Ave");

            // we already have what we edited, the edited copy should be all that is left
            HashSet <kid> expectedList = new HashSet <kid>();
            kid           expected     = new kid("Don Roberts/Heaven Ave");

            expectedList.Add(expected);

            CollectionAssert.Equals(expectedList.ToList(), kid_list_box.getSet().ToList());
        }
示例#3
0
        public void getSetTest()
        {
            vehicleListBox    vehicles_list_box = new vehicleListBox();
            HashSet <vehicle> vSet     = new HashSet <vehicle>();
            vehicle           mohammad = new vehicle("mohammed/12");
            vehicle           chris    = new vehicle("chris/1920");

            vehicles_list_box.add(chris);
            vehicles_list_box.add(mohammad);
            vSet.Add(chris);
            vSet.Add(mohammad);
            CollectionAssert.AreEqual(vSet.ToList(), vehicles_list_box.getSet().ToList());

            HashSet <kid> k             = new HashSet <kid>();
            kidListBox    kids_list_box = new kidListBox();
            kid           turki         = new kid("turki/1720");
            kid           simon         = new kid("simon/1222");

            kids_list_box.add(simon);
            kids_list_box.add(turki);
            k.Add(simon);
            k.Add(turki);
            CollectionAssert.AreEqual(k.ToList(), kids_list_box.getSet().ToList());
        }
示例#4
0
        public void containsTest()
        {
            vehicleListBox vehicles_list_box = new vehicleListBox();
            vehicle        chris             = new vehicle("chris/1920");

            vehicles_list_box.add(chris);
            Assert.IsTrue(vehicles_list_box.contains(chris));


            kidListBox kids_list_box = new kidListBox();
            kid        turki         = new kid("turki/1720");

            kids_list_box.add(turki);
            Assert.IsTrue(kids_list_box.contains(turki));
        }
示例#5
0
        public void editKidTest()
        {
            // make a kid and add him to the list
            kidListBox kid_list_box = new kidListBox();
            kid        child        = new kid("Simon Owens", "Lincoln Ave");

            kid_list_box.add(child);

            // edit him
            kid_list_box.edit(child, "Don Roberts", "Heaven Ave");

            // only kid that should exist is the kid that we edited
            HashSet <kid> expectedList = new HashSet <kid>();
            kid           expected     = new kid("Don Roberts/Heaven Ave");

            expectedList.Add(expected);

            CollectionAssert.Equals(expectedList.ToList(), kid_list_box.getSet().ToList());
        }