Exemple #1
0
        public void RoomCheckInTestForAnyRoom()
        {
            char[,] array =
            {
                { 'a', 'b', 'c', 'd', 'e' },
                { 'e', 'd', 'c', 'b', 'a' },
                { 'a', 'b', 'c', 'd', 'e' },
                { 'e', 'd', 'c', 'B', 'a' }
            };

            //char[,] array = {
            //    { 'a', 'b', 'c', 'd', 'e','f' },
            //    { 'f', 'e', 'd', 'c', 'b','a' },
            //    { 'a', 'b', 'c', 'd', 'e','F' },
            //    { 'f', 'e', 'd', 'c', 'b','A' },
            //    { 'a', 'b', 'C', 'D', 'e','f' },
            //    { 'f', 'E', 'd', 'c', 'b','A' }};

            var hotel = new BoutiqueHotel();
            //Get the nearest available room
            var nearestRoom = hotel.FindNearestVacantRoom(array);
            // check the Availability
            var isAvailable1 = hotel.CheckRoomAvailability(array, nearestRoom);

            Assert.AreEqual(true, isAvailable1);
            // checkIn the guest.
            var newArray = hotel.RoomCheckIn(array, nearestRoom);
            //when the guestcheckIn verify the room availability.
            var isAvailable2 = hotel.CheckRoomAvailability(newArray, nearestRoom);

            Assert.AreEqual(false, isAvailable2);
        }
Exemple #2
0
        public void RoomCheckOutTestForAnyRoomOccupy()
        {
            char[,] array =
            {
                { 'a', 'b', 'c', 'D', 'e' },
                { 'e', 'd', 'C', 'b', 'a' },
                { 'a', 'b', 'c', 'd', 'e' },
                { 'e', 'd', 'c', 'B', 'a' }
            };

            //char[,] array = {
            //    { 'a', 'b', 'c', 'd', 'e','f' },
            //    { 'f', 'e', 'd', 'c', 'b','a' },
            //    { 'a', 'b', 'c', 'd', 'e','F' },
            //    { 'f', 'e', 'd', 'c', 'b','A' },
            //    { 'a', 'b', 'C', 'D', 'e','f' },
            //    { 'f', 'E', 'd', 'c', 'b','A' }};

            var hotel = new BoutiqueHotel();
            var room  = new RoomNumber()
            {
                floor = 3, room = 'B'
            };
            var isAvailable1 = hotel.CheckRoomAvailability(array, room);

            //check the room is occoupy
            Assert.AreEqual(false, isAvailable1);
            //when the room is occoupy,then checkout the guest.
            var newArray = hotel.RoomCheckOut(array, room);
            //When the guest checkOut room should be availability
            var isCheckIn2 = hotel.CheckRoomAvailability(newArray, room);

            Assert.AreEqual(true, isCheckIn2);
        }
        public void BoutiqueHotelTestForMultipleCheckOut()
        {
            char[,] array =
            {
                { 'A', 'b', 'c', 'd', 'E' },
                { 'e', 'D', 'c', 'b', 'A' },
                { 'a', 'B', 'c', 'd', 'e' },
                { 'e', 'd', 'c', 'B', 'a' }
            };

            //char[,] array = {
            //    { 'a', 'b', 'c', 'd', 'e','f' },
            //    { 'f', 'e', 'd', 'c', 'b','a' },
            //    { 'a', 'b', 'c', 'd', 'e','F' },
            //    { 'f', 'e', 'd', 'c', 'b','A' },
            //    { 'a', 'b', 'c', 'D', 'e','f' },
            //    { 'f', 'E', 'd', 'c', 'b','A' }};
            var hotel = new BoutiqueHotel();
            var room1 = new RoomNumber()
            {
                floor = 1, room = 'D'
            };

            // CheckOut the guest.
            hotel.RoomCheckOut(array, room1);
            //when the guest checkout verify the room availability.
            var isAvailable1 = hotel.CheckRoomAvailability(array, room1);

            Assert.AreEqual(true, isAvailable1);

            var room2 = new RoomNumber()
            {
                floor = 2, room = 'E'
            };

            hotel.RoomCheckOut(array, room2);
            var isAvailable2 = hotel.CheckRoomAvailability(array, room2);

            Assert.AreEqual(true, isAvailable2);

            var room3 = new RoomNumber()
            {
                floor = 4, room = 'A'
            };

            hotel.RoomCheckOut(array, room3);
            var isAvailable3 = hotel.CheckRoomAvailability(array, room3);

            Assert.AreEqual(true, isAvailable3);

            //After all the guest checkout ,check all the available rooms.
            var result = hotel.FindAllAvailableRoom(array).ToList();

            Assert.AreEqual(9, result.Count);
        }
        public void BoutiqueHotelTestForMultipleCheckIn()
        {
            char[,] array =
            {
                { 'A', 'b', 'c', 'd', 'E' },
                { 'e', 'D', 'c', 'b', 'A' },
                { 'a', 'B', 'c', 'd', 'e' },
                { 'e', 'd', 'c', 'B', 'a' }
            };

            //char[,] array = {
            //    { 'a', 'b', 'c', 'd', 'e','f' },
            //    { 'f', 'e', 'd', 'c', 'b','a' },
            //    { 'a', 'b', 'c', 'd', 'e','F' },
            //    { 'f', 'e', 'd', 'c', 'b','A' },
            //    { 'a', 'b', 'c', 'D', 'e','f' },
            //    { 'f', 'E', 'd', 'c', 'b','A' }};
            var hotel = new BoutiqueHotel();
            //Get the nearest available room
            var nearestRoom1 = hotel.FindNearestVacantRoom(array);

            // checkIn the guest.
            hotel.RoomCheckIn(array, nearestRoom1);
            //when the guestcheckIn verify the room availability.
            var isAvailable1 = hotel.CheckRoomAvailability(array, nearestRoom1);

            Assert.AreEqual(false, isAvailable1);

            var nearestRoom2 = hotel.FindNearestVacantRoom(array);

            hotel.RoomCheckIn(array, nearestRoom2);
            var isAvailable2 = hotel.CheckRoomAvailability(array, nearestRoom2);

            Assert.AreEqual(false, isAvailable2);

            var nearestRoom3 = hotel.FindNearestVacantRoom(array);

            hotel.RoomCheckIn(array, nearestRoom3);
            var isAvailable3 = hotel.CheckRoomAvailability(array, nearestRoom3);

            Assert.AreEqual(false, isAvailable3);

            var nearestRoom4 = hotel.FindNearestVacantRoom(array);

            hotel.RoomCheckIn(array, nearestRoom4);
            var isAvailable4 = hotel.CheckRoomAvailability(array, nearestRoom4);

            Assert.AreEqual(false, isAvailable4);

            //After all the guest checkIn ,check all the available rooms.
            var result = hotel.FindAllAvailableRoom(array).ToList();

            Assert.AreEqual(2, result.Count);
        }
Exemple #5
0
        public void CheckRoomAvailabilityTestForAlreadyOccupy()
        {
            char[,] array =
            {
                { 'A', 'b', 'C', 'd', 'e' },
                { 'e', 'D', 'c', 'b', 'a' },
                { 'a', 'b', 'c', 'd', 'e' },
                { 'E', 'd', 'c', 'b', 'A' }
            };

            var hotel = new BoutiqueHotel();
            var room  = new RoomNumber()
            {
                floor = 3, room = 'E'
            };
            var isCheckIn = hotel.CheckRoomAvailability(array, room);

            Assert.AreEqual(false, isCheckIn);
        }