Exemplo n.º 1
0
        public void RemoveRental(SingleRental rental)
        {
            Debug.Assert(rental != null);
            var removed = _rentals.Remove(rental);

            if (!removed)
            {
                throw new RentalException("Rental not found");
            }
        }
Exemplo n.º 2
0
 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);
 }