public void BookMyRoom_ConfirmBooking_WrongDetails() { //Arrange BookMyRoomManager booking = new BookMyRoomManager(); BookingTransfer bookingTransfer = new BookingTransfer(); bookingTransfer.bookingAmount = 10000; bookingTransfer.bookingDate = DateTime.Today; bookingTransfer.checkInDate = DateTime.Today; bookingTransfer.checkOutDate = DateTime.Today.AddDays(8); bookingTransfer.discountAmount = 100; bookingTransfer.roomId = 1; var confirmbooking = booking.Confirm_Booking(bookingTransfer); //Assert Assert.AreEqual(false, confirmbooking); }
public HttpResponseMessage Confirm_Booking(BookingTransfer bookingdetails) { //Calling Confirm_Booking method in Business Layer by passing bookingdetails parameter which returns an integer if (bookingdetails == null) { //If the bookingdetails is null ArgumentNullException will be thrown throw new ArgumentNullException("Bookingdetails cannot be null"); } bool result = bookMyRoomManager.Confirm_Booking(bookingdetails); //Checking whether the result is true or false if (result) { return(Request.CreateErrorResponse(HttpStatusCode.Created, "Booking is done Sucessfully")); } else { //If the result is false the InternalServerError will be thrown throw new DivideByZeroException("InternalServerError"); } }