Beispiel #1
0
        public void UpdatingItems()
        {
            CreatingItems();
            var newItem = _carRepo.GetCarById(1);

            newItem.Id             = 1;
            newItem.Make           = "UpdatedMake";
            newItem.Model          = "UpdatedModel";
            newItem.Propulsion     = "";
            newItem.Collision      = .1;
            newItem.Comprehensive  = .1;
            newItem.PersonalInjury = .1;


            _carRepo.UpdateCar(1, newItem);

            var checkItem = _carRepo.GetCarById(1);

            Assert.AreEqual("UpdatedMake", checkItem.Make);
        }
        private static ushort FindCarByID()
        {
            Console.Write("Enter car ID number : >");
            string checkId = (Console.ReadLine());

            if (ushort.TryParse(checkId, out ushort getId))
            {
                var carToUpdate = _carRepo.GetCarById(getId);
                if (carToUpdate == null)
                {
                    Console.WriteLine("ERROR: Check the ID number and try again.\n\n"); MenuOps.MenuSelections();
                }

                Console.WriteLine($"\nSelected vehicle {carToUpdate.Make} {carToUpdate.Model}\n");
            }
            else
            {
                Console.WriteLine("ERROR: Check the ID number and try again.\n\n"); MenuOps.MenuSelections();
            }

            return(getId);
        }