public void GivenDetailsOf3Hotels_WhenAddedToHotelList_ReturnSizeOfListAs3()
        {
            ManageHotels hotelManager = new ManageHotels(CustomerType.REGULAR);
            int          expected     = 3;

            hotelManager.AddHotel(new Hotel("Lakewood", 110, 90, 80, 80, 3));
            hotelManager.AddHotel(new Hotel("Bridgewood", 160, 60, 110, 150, 4));
            hotelManager.AddHotel(new Hotel("Ridgewood", 220, 150, 100, 40, 5));
            int actual = hotelManager.hotels.Count();

            Assert.AreEqual(expected, actual);
        }
        public void GivenDateRange_FindBestRatedCheapestHotelMethod_ShouldReturnBestRatedFromCheapestHotelsForRegularcustomer()
        {
            DateTime start    = DateTime.Parse("12Nov2020");
            DateTime end      = DateTime.Parse("14Nov2020");
            string   expected = "Ridgewood";

            ManageHotels hotelManager = new ManageHotels(CustomerType.REGULAR);

            hotelManager.AddHotel(new Hotel("Lakewood", 110, 90, 80, 80, 3));
            hotelManager.AddHotel(new Hotel("Bridgewood", 160, 60, 110, 150, 4));
            hotelManager.AddHotel(new Hotel("Ridgewood", 110, 90, 100, 40, 5));
            List <Hotel> cheapestHotelsList = hotelManager.FindCheapestBestRatedHotel(start, end);

            Assert.AreEqual(expected, cheapestHotelsList[0].name);
        }
        public void GivenDateRange_FindCheapestHotelInAGivenDateRangeMethod_ShouldReturnCheapestHotelForRewardCustomer()
        {
            DateTime start    = DateTime.Parse("12Nov2020");
            DateTime end      = DateTime.Parse("14Nov2020");
            string   expected = "Lakewood";

            ManageHotels hotelManager = new ManageHotels(CustomerType.REWARD);

            hotelManager.AddHotel(new Hotel("Lakewood", 110, 90, 80, 80, 3));
            hotelManager.AddHotel(new Hotel("Bridgewood", 160, 60, 110, 150, 4));
            hotelManager.AddHotel(new Hotel("Ridgewood", 220, 150, 100, 40, 5));
            List <Hotel> cheapestHotels = hotelManager.FindCheapestHotelInAGivenDateRange(start, end);

            Assert.AreEqual(expected, cheapestHotels[0].name);
        }
Exemple #4
0
        public void TestAddHotelMethodByPassingAnEmptyListAndMakingItAddHotels()
        {
            List <Hotel> hotelList2 = new List <Hotel>();
            Hotel        hotel      = new Hotel()
            {
                hotelName = "Lakewood", regularRate = 110, regularRateWeekend = 90, rating = 3, rewardRate = 80, rewardRateWeekend = 80
            };

            hotelList2.Add(hotel);
            hotel = new Hotel()
            {
                hotelName = "Bridgewood", regularRate = 150, regularRateWeekend = 50, rating = 4, rewardRate = 110, rewardRateWeekend = 50
            };
            hotelList2.Add(hotel);
            hotel = new Hotel()
            {
                hotelName = "Ridgewood", regularRate = 220, regularRateWeekend = 150, rating = 5, rewardRate = 100, rewardRateWeekend = 40
            };
            hotelList2.Add(hotel);
            List <Hotel> hotelList = new List <Hotel>();

            ManageHotels.AddHotel(hotelList);

            string[] hotelNames = { "Lakewood", "BridgeWood", "RidgeWood" };
            for (int i = 0; i < hotelNames.Length; i++)
            {
                Assert.AreEqual(hotelList[i].hotelName, hotelList2[i].hotelName);
            }
        }
        public void GivenDateRange_FindCheapestHotelInAGivenDateRangeMethod_ShouldReturnAllAvailableCheapestHotelsForRegularcustomer()
        {
            DateTime start = DateTime.Parse("12Nov2020");
            DateTime end   = DateTime.Parse("14Nov2020");

            string[] expected = { "Lakewood", "Ridgewood" };

            ManageHotels hotelManager = new ManageHotels(CustomerType.REGULAR);

            hotelManager.AddHotel(new Hotel("Lakewood", 110, 90, 80, 80, 3));
            hotelManager.AddHotel(new Hotel("Bridgewood", 160, 60, 110, 150, 4));
            hotelManager.AddHotel(new Hotel("Ridgewood", 110, 90, 100, 40, 5));
            List <Hotel> cheapestHotelsList = hotelManager.FindCheapestHotelInAGivenDateRange(start, end);

            string[] cheapestHotelsArray = cheapestHotelsList.Select(hotel => hotel.name).ToArray();

            CollectionAssert.AreEqual(expected, cheapestHotelsArray);
        }
        public void GivenDateRange_FindBestRatedHotelMethod_ShouldReturnAllBestRatedHotelsForRewardCustomer()
        {
            DateTime start = DateTime.Parse("12Nov2020");
            DateTime end   = DateTime.Parse("14Nov2020");

            string[] expected = { "Ridgewood" };

            ManageHotels hotelManager = new ManageHotels(CustomerType.REWARD);

            hotelManager.AddHotel(new Hotel("Lakewood", 110, 90, 80, 80, 3));
            hotelManager.AddHotel(new Hotel("Bridgewood", 160, 60, 110, 150, 4));
            hotelManager.AddHotel(new Hotel("Ridgewood", 110, 90, 100, 40, 5));
            List <Hotel> bestHotelsList = hotelManager.FindCheapestBestRatedHotel(start, end);

            string[] bestHotelsArray = bestHotelsList.Select(hotel => hotel.name).ToArray();

            CollectionAssert.AreEqual(expected, bestHotelsArray);
        }