コード例 #1
0
        public void GivenWeekendAndWeekdayRateReturnCheapestHotelAlongWithRating()
        {
            hotelSystem.AddHotel(new Hotel("Lakewood", 3, 110, 90));
            hotelSystem.AddHotel(new Hotel("Bridgewood", 4, 150, 50));
            hotelSystem.AddHotel(new Hotel("Ridgewood", 5, 220, 150));
            string[]   dates = "11Sep2020,12Sep2020".Split(",");
            DateTime[] date  = new DateTime[2];
            date[0] = DateTime.Parse(dates[0]);
            date[1] = DateTime.Parse(dates[1]);
            Hotel cheapestHotel = hotelSystem.GetCheapestHotelWithBestRating(date);

            Assert.AreEqual(4, cheapestHotel.rating);
        }
コード例 #2
0
        public void GivenWeekendAndWeekdayRateReturnCheapestAndBestRatedHotel()
        {
            hotelSystem.AddHotel(new Hotel("Lakewood", 4, 10000, 11000));
            hotelSystem.AddHotel(new Hotel("Bridgewood", 5, 5000, 6000));
            hotelSystem.AddHotel(new Hotel("Ridgewood", 3, 20000, 21000));
            string[]   dates = "10Dec2020,11Dec2020".Split(",");
            DateTime[] date  = new DateTime[2];
            date[0] = DateTime.Parse(dates[0]);
            date[1] = DateTime.Parse(dates[1]);
            Hotel cheapestHotel = hotelSystem.GetCheapestHotelWithBestRating(date);

            Assert.AreEqual(5, cheapestHotel.rating);
        }