Example #1
0
        public void GivenWeekendRate_ShouldAddToHotelProperties()
        {
            //Arrange
            MiamiHotels.HotelList.Clear();
            MiamiHotels.AddHotel("Lakewood", 120);
            double expectedWeekendRate = 80;

            //Act
            MiamiHotels.AddWeekendRate("Lakewood", expectedWeekendRate);
            //Assert
            Assert.AreEqual(expectedWeekendRate, MiamiHotels.HotelList["Lakewood"].WeekendRates);
        }
Example #2
0
        public void GivenWrongHotelName_ShouldThrowCustomException()
        {
            //Arrange
            MiamiHotels.HotelList.Clear();
            MiamiHotels.AddHotel("Lakewood", 120);
            Exception exception = new Exception();

            //Act
            try
            {
                MiamiHotels.AddWeekendRate("lakewood", 80);    //testing typoerror
            }
            catch (HotelReservationException e)
            {
                exception = e;
            }
            //Assert
            Assert.AreEqual("Hotel do not exist", exception.Message);
        }
Example #3
0
        public void GivenHotelNameAsNull_ShouldThrowCustomException()
        {
            //Arrange
            MiamiHotels.HotelList.Clear();
            MiamiHotels.AddHotel("Lakewood", 120);
            Exception exception = new Exception();

            //Act
            try
            {
                MiamiHotels.AddWeekendRate(null, 80);
            }
            catch (HotelReservationException e)
            {
                exception = e;
            }
            //Assert
            Assert.AreEqual("Hotel name can not be null", exception.Message);
        }
Example #4
0
        public void GivenZeroAsWeekendRate_ShouldThrowCustomException()
        {
            //Arrange
            MiamiHotels.HotelList.Clear();
            MiamiHotels.AddHotel("Lakewood", 120);
            Exception exception = new Exception();

            //Act
            try
            {
                MiamiHotels.AddWeekendRate("Lakewood", 0);
            }
            catch (HotelReservationException e)
            {
                exception = e;
            }
            //Assert
            Assert.AreEqual("Hotel rate can not be zero", exception.Message);
        }