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()); }
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()); }