Exemplo n.º 1
0
        public void GivenDateRange_ShouldReturn_BestRatedHotelDetails()
        {
            //Arrange
            ReservationSystemBuilder reservationSystem = new ReservationSystemBuilder();
            //Act
            string hotelDetail = reservationSystem.FindBestRatedHotel("13Nov2020", "14Nov2020");

            //Assert
            Assert.AreEqual(hotelDetail, "Ridgewood, Total Rates: $370");
        }
Exemplo n.º 2
0
        public void GivenWrongMonthValue_ShouldThrowCustomException()
        {
            //Arrange
            ReservationSystemBuilder reservationSystem = new ReservationSystemBuilder();
            Exception exception = new Exception();

            //Act
            try
            {
                string hotelDetail = reservationSystem.FindBestRatedHotel("05Navember2020", "05November2020");
            }
            catch (HotelReservationException e)
            {
                exception = e;
            }
            //Assert
            Assert.AreEqual(exception.Message, "Incorrect month value");
        }
Exemplo n.º 3
0
        public void GivenIncorrectDateFormat_ShouldThrowCustomException()
        {
            //Arrange
            ReservationSystemBuilder reservationSystem = new ReservationSystemBuilder();
            Exception exception = new Exception();

            //Act
            try
            {
                string hotelDetail = reservationSystem.FindBestRatedHotel("SevenNov2020", "NineNov2020");
            }
            catch (HotelReservationException e)
            {
                exception = e;
            }
            //Assert
            Assert.AreEqual(exception.Message, "Wrong date format");
        }
Exemplo n.º 4
0
        public void GivenEndDateBeforeStartDate_ShouldThrowCustomException()
        {
            //Arrange
            ReservationSystemBuilder reservationSystem = new ReservationSystemBuilder();
            Exception exception = new Exception();

            //Act
            try
            {
                string hotelDetail = reservationSystem.FindBestRatedHotel("05Nov2020", "03Nov2020");
            }
            catch (HotelReservationException e)
            {
                exception = e;
            }
            //Assert
            Assert.AreEqual(exception.Message, "End date can not be before start date");
        }