示例#1
0
        public void CorrectlyAddVehicle()
        {
            string plate = "912389SADAB1JSK";

            int vehiclesInList  = vvm.VehiclesCollection.Count;
            int vehiclesInModel = new List <Vehicle>(Vehicles.All()).Count;

            vvm.AddVehicle(true);
            Assert.AreNotEqual(null, vvm.AddVehicleWindow);
            vvm.HandleAddVehicle(plate, 1);

            Assert.AreEqual(vehiclesInList + 1, vvm.VehiclesCollection.Count);
            Assert.AreEqual(vehiclesInModel + 1, new List <Vehicle>(Vehicles.All()).Count);

            List <Vehicle> vehiclesList = new List <Vehicle>(Vehicles.All());
            Vehicle        vehicle      = vehiclesList.FindLast(i => i.Plate == plate);

            if (vehicle == null)
            {
                Assert.Fail();
            }

            vvm.SelectedVehicle = vehicle;
            Vehicles.Delete(vehicle.Id);
        }