Exemple #1
0
        public void TestEditBookingResultsSuccess()
        {
            //Grabs the List of all active bookings in DB and assigns the first record from the listing to a int id
            int id = getThem[getThem.Count - 1].BookingID;
            //retrieves the full booking information, assigns the initial quantity to an int
            //Does not change the record, just checks to make sure all steps going through.
            Booking booking1 = myBook.RetrieveBooking(id);
            int     original = booking1.Quantity;
            //Passes the object to the EditBookingResults method and asserts that that result will be successful
            ResultsEdit result   = myBook.EditBookingResult(original, booking1);
            ResultsEdit expected = ResultsEdit.Success;

            Assert.AreEqual(expected, result);
        }
Exemple #2
0
        /// <summary>
        /// Ryan Blake
        /// Created: 2015/03/06
        /// To check if the quantity is going up and see if the booking is already full
        /// </summary>
        /// <remarks>
        /// Tony Noel
        /// Updated: 2015/03/10
        /// if the booking has occured already, it cannot be changed.
        ///
        /// Pat Banks
        /// Updated: 2015/03/11
        /// up/down controls added for quantity and discount
        ///
        /// Pat Banks
        /// Updated: 2015/03/19
        /// Moved decision logic to booking manager
        /// </remarks>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void btnSubmitBooking_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                //get form info
                Booking editedBookingRecord = GatherFormInformation();

                //get results of adding booking
                ResultsEdit result = _bookingManager.EditBookingResult(CurrentBookingDetails.Quantity, editedBookingRecord);

                switch (result)
                {
                case (ResultsEdit.QuantityZero):
                    throw new ApplicationException("Please use cancel instead of setting quantity 0.");

                case (ResultsEdit.Success):
                    await this.ShowMessageDialog(string.Format("The booking has been successfully {0}.", CurrentBookingDetails == null ? "added" : "updated"));

                    DialogResult = true;
                    Close();
                    break;

                case (ResultsEdit.ListingFull):
                    throw new ApplicationException("This event is already full. You cannot add more guests to it.");

                case (ResultsEdit.ChangedByOtherUser):
                    throw new ApplicationException("Changed by another user");
                }
            }
            catch (Exception ex)
            {
                throw new WanderingTurtleException(this, ex);
            }
        }
Exemple #3
0
        public void TestEditBookingResultsSuccess()
        {
            //Tests the Edit Booking Results method in the Booking Manager- which takes an int and a Booking object.
            //Grabs the ID for the dummy booking
            int id = TestCleanupAccessor.GetBooking();
            //retrieves the full booking information, assigns the initial quantity to an int, then reassigns the object quantity
            //to a new amount
            Booking booking1 = myBook.RetrieveBooking(id);
            int     original = booking1.Quantity;

            booking1.Quantity = 4;
            //Passes the object to the EditBookingResults method and asserts that that result will be successful
            ResultsEdit result   = myBook.EditBookingResult(original, booking1);
            ResultsEdit expected = ResultsEdit.Success;

            Assert.AreEqual(expected, result);
        }