public void canCalculateBasePrice_8() {//add evening meal for more days //calculate with people //create test Booking and test guests createTestBooking2(); createTestGuest(); createTestGuest2(); //add guests to the guest list of the booking testBooking2.AddGuest(testGuest); testBooking2.AddGuest(testGuest2); //expected //(60(chalet per night) * 5(number of nights)) + (2(people) * 5(number of nights) * 25(night per person)) //+ 10(evening meal price) * 5(number of nights) * 2(people) double expectedPrice = 1200; //run double actualPrice = testBooking2.CalculatePrice(testBooking2.numberOfGuests(), testBooking2.numberOfNights(), 0); //baseprice //add extra testBooking2.EveningMeal = true; EveningMeal_add eveningMeal = new EveningMeal_add(); eveningMeal.AddTo(testBooking); actualPrice += eveningMeal.CalculatePrice(testBooking2.numberOfGuests(), testBooking2.numberOfNights(), 0); //carhire days is 0, only calculating base price //test Assert.AreEqual(expectedPrice, actualPrice, "Booking price is not correct, price calculation FAILED."); }
private void btn_extra_eveningMeal_Click(object sender, RoutedEventArgs e) {//Add evening meal prices //get the booking Booking selectedBooking = Bookings.getBooking(getSelectedKey_BookingRef()); selectedBooking.EveningMeal = true; //store the extra //create new evening meal EveningMeal_add eveningMeal = new EveningMeal_add(); eveningMeal.AddTo(selectedBooking); //calculate the new price calculateTotalPrice(selectedBooking, eveningMeal); //display cost lbl_eveningMeal_cost.Content += eveningMeal.getCost(); lbl_eveningMeal_cost.Visibility = Visibility.Visible; //switch the buttons refreshExtrasButtons(); }