Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

...

The verbal description of this method is "reserve a room for week week, for name name". Reserve

  • checks whether there is a free room and throws a NoRoomException if there isn't
  • checks whether there already is a reservation for the given name and week, because this constitute an error in our toy-world (see restrictions above) FIXME
  • if everything turns out well, a ReservationInfo instance with name and week is added to the repository

If the checks give green light,
Reserve returns the freshly minted IReservationInfo instance.

...

Cancel is polymorphic, two versions exist:

  • IReservationInfo Cancel (IReservationInfo reservationInfo) is a thin wrapper around the repository's Remove method
  • IReservationInfo Cancel (string name, int week) is the more convenient relative that does error checking and creates the IReservationInfo instance for you, from the name and week parameters

Trying to cancel a reservation that does not exist in the repository is an error, of course.