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); }
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); }
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); }
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); }