public void A120_GetListForCarKey() { List <OwnerCar> ownerCars = ownerCarsRepository.GetListForForCarKey(Car1.PrimaryKey); Assert.AreEqual(numberOfOwnerCarsForCar, ownerCars.Count); Assert.AreEqual(OwnerCar1.PrimaryKey, ownerCars[0].PrimaryKey); }
/// <summary>Validations done to an entity for the passed primary key before it is deleted.</summary> /// <param name="primaryKey">The primary key of the entity to delete.</param> /// <exception cref="GTSport_DT.Cars.CarNotFoundException"> /// If the car key can not be found to delete. /// </exception> /// <exception cref="GTSport_DT.Cars.CarInUseException"> /// If the car is in use for a owned car. /// </exception> public override void ValidateDelete(string primaryKey) { Car car = carsRepository.GetById(primaryKey); if (car == null) { throw new CarNotFoundException(CarNotFoundException.CarKeyNotFoundMsg, primaryKey); } List <OwnerCar> ownerCars = ownerCarsRepository.GetListForForCarKey(primaryKey); if (ownerCars.Count > 0) { throw new CarInUseException(CarInUseException.CarInUseOwnedCarMsg); } }