예제 #1
0
        public void TestAvailableQuantity()
        {
            //Tests to see what the available quantity will be.
            int max      = 10;
            int current  = 5;
            int quantity = myBook.AvailableQuantity(max, current);
            int expected = 5;

            Assert.AreEqual(expected, quantity);
        }
예제 #2
0
        /// <summary>
        /// Pat Banks
        /// Created: 2015/03/19
        /// Populates text fields with object data
        /// </summary>
        private void PopulateTextFields()
        {
            //get latest data on the eventItemListing
            _eventListingToView = _bookingManager.RetrieveItemListingDetailsList(CurrentBookingDetails.ItemListID);
            _eventListingToView.QuantityOffered = _bookingManager.AvailableQuantity(_eventListingToView.MaxNumGuests, _eventListingToView.CurrentNumGuests);

            //populate form fields with object data
            LblEditBookingGuestName.Content = CurrentInvoice.GetFullName;
            LblEventName.Content            = CurrentBookingDetails.EventItemName;
            LblStartDate.Content            = CurrentBookingDetails.StartDate;
            LblTicketPrice.Content          = CurrentBookingDetails.TicketPrice.ToString("c");
            LblTotalDue.Content             = CurrentBookingDetails.TotalCharge.ToString("c");

            UdAddBookingQuantity.Value = CurrentBookingDetails.Quantity;
            UdDiscount.Value           = (double?)CurrentBookingDetails.Discount;

            LblAvailSeats.Content = _eventListingToView.QuantityOffered;

            //calculates the maximum quantity for the u/d
            UdAddBookingQuantity.Maximum = CurrentBookingDetails.Quantity + _eventListingToView.QuantityOffered;
        }