public void RemoveRental(SingleRental rental) { Debug.Assert(rental != null); var removed = _rentals.Remove(rental); if (!removed) { throw new RentalException("Rental not found"); } }
public void AddRental(SingleRental rental) { Debug.Assert(rental != null); if (_rentals.Count == MaxRentals) { throw new RentalException("Max number of rentals reached"); } if (_rentals.Contains(rental)) { throw new RentalException("Rental has already been added"); } _rentals.Add(rental); }