//Boolean bookSeats(int num) public void b1_IsbookAllSeatsSuccessful() { bool actual = testSeatObj.bookSeats(10); //book 10 seats in economy class is successful Assert.IsTrue(actual, "Booking seats unsuccessful"); }
public Boolean bookSeats(int priceCode, int number, Customer theCustomer) //number is total number of seats booked { switch (priceCode) { case Seat.Economy: { ArrayList theEconomy = theFlight.getEconomy(); IEnumerator theEnum = theEconomy.GetEnumerator(); while (theEnum.MoveNext()) { Seat theSeat = (Seat)theEnum.Current; if (theSeat.bookSeats(number)) { Invoice newBooking = new Invoice(priceCode, theCustomer, theEconomy.IndexOf(theSeat) + 1, theSeat.getLastBooked(), number); customerBookings.Add(theCustomer, newBooking); return(true); } } return(false); } case Seat.FirstClass: { ArrayList theFirstClass = theFlight.getFirstClass(); IEnumerator theEnum = theFirstClass.GetEnumerator(); while (theEnum.MoveNext()) { Seat theSeat = (Seat)theEnum.Current; if (theSeat.bookSeats(number)) { Invoice newBooking = new Invoice(priceCode, theCustomer, theFirstClass.IndexOf(theSeat) + 1, theSeat.getLastBooked(), number); customerBookings.Add(theCustomer, newBooking); return(true); } } return(false); } } return(false); }