public void TestBookingCalcCancellationFee() { //Creates a bookingDetails object used to perform calculations. Method uses the TotalCharge and the startdate BookingDetails bookingD = new BookingDetails(); DateTime value = new DateTime(2000, 01, 31); bookingD.StartDate = value; bookingD.TotalCharge = 3.0m; decimal expected = 3.0m; decimal result = myBook.CalculateCancellationFee(bookingD); //Asserts that the expected and the result will be .5M Assert.AreEqual(expected, result); }
/// <summary> /// Tony Noel /// Created: 2015/03/04 /// Attempts to populate the UI and the Guest labels with text pertaining to the guest booking /// </summary> /// <remarks> /// Pat Banks /// Updated: 2015/03/08 /// Updated with new fields and formatting; Moved fee calculation to BLL /// </remarks> private void PopulateText() { //populating with data from objects that opened the form LblBookingId.Content = CurrentBooking.BookingID; LblGuestName.Content = CurrentInvoice.GetFullName; LblQuantity.Content = CurrentBooking.Quantity; LblEventName.Content = CurrentBooking.EventItemName; LblDiscount.Content = CurrentBooking.Discount.ToString("p"); LblEventTime.Content = CurrentBooking.StartDate; LblTicketPrice.Content = CurrentBooking.TicketPrice.ToString("c"); LblTotalDue.Content = CurrentBooking.TotalCharge.ToString("c"); _cancelFee = _bookingManager.CalculateCancellationFee(CurrentBooking); LblCancelMessage.Content = "A fee of " + _cancelFee.ToString("c") + " will be charged to cancel this booking."; }