public void GivenHotelRating_ShouldAddToHotelProperties() { //Arrange MiamiHotels.HotelList.Clear(); MiamiHotels.AddHotel("Lakewood", 120, 80); int expectedRating = 3; //Act MiamiHotels.AddRating("Lakewood", expectedRating); //Assert Assert.AreEqual(expectedRating, MiamiHotels.HotelList["Lakewood"].Rating); }
public void GivenNegativeHotelRating_ShouldThrowCustomException() { //Arrange MiamiHotels.HotelList.Clear(); MiamiHotels.AddHotel("Lakewood", 120, 80); Exception exception = new Exception(); //Act try { MiamiHotels.AddRating("Lakewood", -3); } catch (HotelReservationException e) { exception = e; } //Assert Assert.AreEqual("Rating can not be negative", exception.Message); }
public void GivenWrongHotelName_ShouldThrowCustomException() { //Arrange MiamiHotels.HotelList.Clear(); MiamiHotels.AddHotel("Lakewood", 120, 80); Exception exception = new Exception(); //Act try { MiamiHotels.AddRating("lakewood", 3); //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, 90); Exception exception = new Exception(); //Act try { MiamiHotels.AddRating(null, 3); } catch (HotelReservationException e) { exception = e; } //Assert Assert.AreEqual("Hotel name can not be null", exception.Message); }