public void CheckToEditBooking() { //Checks the edit booking and makes sure a result is returned. bookingDetails = new BookingDetails(); bookingDetails.StartDate = DateTime.Now; bookingDetails.Quantity = 2; ResultsEdit result = myBook.CheckToEditBooking(bookingDetails); Assert.IsNotNull(result); }
/// <summary> /// Miguel Santana /// Created: 2015/04/06 /// added read-only capability to the ui /// </summary> /// <param name="selectedItem"></param> /// <param name="readOnly"></param> private void OpenBookingDetail(BookingDetails selectedItem = null, bool readOnly = false) { try { if (selectedItem == null) { if (new AddBooking(CurrentInvoice).ShowDialog() == false) { return; } RefreshBookingList(); } else { if (readOnly) { new EditBooking(CurrentInvoice, selectedItem, true).ShowDialog(); return; } //check if selected item can be edited switch (_bookingManager.CheckToEditBooking(selectedItem)) { case (ResultsEdit.CannotEditTooOld): throw new WanderingTurtleException(this, "Bookings in the past cannot be edited."); case (ResultsEdit.Cancelled): throw new WanderingTurtleException(this, "This booking has been cancelled and cannot be edited."); case (ResultsEdit.OkToEdit): if (new EditBooking(CurrentInvoice, selectedItem).ShowDialog() == false) { return; } RefreshBookingList(); break; } } } catch (Exception ex) { throw new WanderingTurtleException(this, ex); } }