Example #1
0
        public void VehicleRemoveTest()
        {
            vehicleListBox vehicles_list_box = new vehicleListBox();
            vehicle        turki             = new vehicle("turki/1720");
            vehicle        chris             = new vehicle("chris/1920");

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

            foreach (vehicle each in vehicles_list_box.getSet())
            {
                Assert.AreNotEqual("turki/1720", each.ToString());
            }
        }
Example #2
0
        public void editAlreadyExisitingVehicleTest()
        {
            // add two vehilces to the list
            vehicleListBox vehicle_list_box = new vehicleListBox();
            vehicle        van1             = new vehicle("Red Van/7");
            vehicle        van2             = new vehicle("Blue Van/10");

            vehicle_list_box.add(van1);
            vehicle_list_box.add(van2);

            // edit one of the vehilces to what another vehicle again.
            vehicle_list_box.edit(van1, "Blue Van", 10);

            // only vehicle that should exist is the vehilce that we edited
            HashSet <vehicle> expectedList = new HashSet <vehicle>();
            vehicle           expected     = new vehicle("Blue Van/10");

            expectedList.Add(expected);

            CollectionAssert.Equals(expectedList.ToList(), vehicle_list_box.getSet().ToList());
        }
Example #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());
        }
Example #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));
        }
Example #5
0
        public void editVehicleTest()
        {
            // make a vehicle and add him to the list
            vehicleListBox vehicle_list_box = new vehicleListBox();
            vehicle        van = new vehicle("Red Van/7");

            vehicle_list_box.add(van);

            // edit it
            vehicle_list_box.edit(van, "Blue Van", 10);

            // only vehicle that should exist is the vehilce that we edited
            HashSet <vehicle> expectedList = new HashSet <vehicle>();
            vehicle           expected     = new vehicle("Blue Van/10");

            expectedList.Add(expected);

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