示例#1
0
        public void CorrectlyDeleteVehicle()
        {
            Vehicle vehicle = Vehicles.Create("98ASD871NFLS91", 1);

            var beforeAdd = vvm.VehiclesCollection.IndexOf(vehicle);

            Assert.AreEqual(-1, beforeAdd);
            Assert.AreEqual(Vehicles.Get(vehicle.Id).Id, vehicle.Id);

            vvm.VehiclesCollection.Add(vehicle);
            var beforeDelete = vvm.VehiclesCollection.IndexOf(vehicle);

            Assert.AreNotEqual(-1, beforeDelete);
            vvm.SelectedVehicle = vehicle;
            vvm.DeleteVehicle();

            var afterDelete = vvm.VehiclesCollection.IndexOf(vehicle);

            Assert.AreEqual(-1, afterDelete);
        }