예제 #1
0
        public void Given_ValidDate_ShouldReturn_CheapestHotel()
        {
            HotelReservation hotelReservation = new HotelReservation();

            hotelReservation.AddHotelToSystem("Lakewood", 110, 90, 3, 80, 80);
            hotelReservation.AddHotelToSystem("Bridgewood", 150, 50, 4, 110, 50);
            hotelReservation.AddHotelToSystem("Ridgewood", 220, 150, 5, 100, 40);
            Assert.AreEqual("Lakewood", hotelReservation.HotelList.First().HotelName);
        }
예제 #2
0
        public void Given_ValidDate_WithBothWeekendAndWeekdays_ShouldReturn_CheapestBestRatedHotelForRewardCustomer()
        {
            HotelReservation hotelReservation = new HotelReservation();

            hotelReservation.AddHotelToSystem("Lakewood", 110, 90, 3, 80, 80);
            hotelReservation.AddHotelToSystem("Bridgewood", 150, 50, 4, 110, 50);
            hotelReservation.AddHotelToSystem("Ridgewood", 220, 150, 5, 100, 40);
            DateTime startDate = Convert.ToDateTime("11-09-2020");
            DateTime endDate   = Convert.ToDateTime("12-09-2020");

            Assert.AreEqual(140, hotelReservation.CheapestBestRatedHotelPriceForRewardCust(startDate, endDate));
        }
예제 #3
0
        public void Given_ValidDate_WithBothWeekendAndWeekdays_ShouldReturn_BestRatedHotel()
        {
            HotelReservation hotelReservation = new HotelReservation();

            hotelReservation.AddHotelToSystem("Lakewood", 110, 90, 3, 80, 80);
            hotelReservation.AddHotelToSystem("Bridgewood", 150, 50, 4, 110, 50);
            hotelReservation.AddHotelToSystem("Ridgewood", 220, 150, 5, 100, 40);
            DateTime startDate = Convert.ToDateTime("11-09-2020");
            DateTime endDate   = Convert.ToDateTime("12-09-2020");

            Assert.AreEqual("Ridgewood", hotelReservation.FindBestRatedHotel(startDate, endDate).HotelName);
            Assert.AreEqual(370, hotelReservation.TotalCost(hotelReservation.FindBestRatedHotel(startDate, endDate), startDate, endDate));
        }
예제 #4
0
        public void Given_HotelNameAndRate_ShouldReturn_HotelAdded()
        {
            HotelReservation hotelReservation = new HotelReservation();
            string           hotelName        = "Lakewood";
            int weekdayRate           = 110;
            int weekendRate           = 90;
            int rating                = 3;
            int rewardCustWeekdayRate = 80;
            int rewardCustWeekendRate = 80;

            hotelReservation.AddHotelToSystem(hotelName, weekdayRate, weekendRate, rating, rewardCustWeekdayRate, rewardCustWeekendRate);
            Assert.AreEqual(1, hotelReservation.availableHotels.Count);
        }
        public static void Main(string[] args)
        {
            Console.WriteLine("Welcome to Hotel Reservation Program ");
            HotelReservation hotelReservation = new HotelReservation();

            hotelReservation.AddHotelToSystem("Lakewood", 110, 90, 3, 80, 80);
            hotelReservation.AddHotelToSystem("Bridgewood", 150, 50, 4, 110, 50);
            hotelReservation.AddHotelToSystem("Ridgewood", 220, 150, 5, 100, 40);
            try
            {
                Console.WriteLine("Enter the start date for your stay in dd-mm-yyyy format : ");
                DateTime startDate = Convert.ToDateTime(Console.ReadLine());
                Console.WriteLine("Enter the end date for your stay in dd-mm-yyyy format : ");
                DateTime endDate = Convert.ToDateTime(Console.ReadLine());
                Console.WriteLine("Enter the Customer type : \n 1. Regular Customer \n 2. Reward Customer");
                int choice = Convert.ToInt32(Console.ReadLine());
                switch (choice)
                {
                case 1:
                    hotelReservation.FindCheapestHotel(startDate, endDate);
                    hotelReservation.FindBestRatedHotel(startDate, endDate);
                    break;

                case 2:
                    hotelReservation.CheapestBestRatedHotelPriceForRewardCust(startDate, endDate);
                    break;

                default:
                    throw new HotelReservationCustomException(HotelReservationCustomException.ExceptionType.INVALID_CHOICE, "Invalid choice");
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }