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);
        }
예제 #2
0
        public void RoomCheckOutTestForAnyRoomAvailable()
        {
            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 = 2, room = 'C'
            };
            var isAvailable1 = hotel.CheckRoomAvailability(array, room);

            //check the room is available
            Assert.AreNotEqual(false, isAvailable1);
            //when the room is occoupy,then checkout the guest.
            var newArray = hotel.RoomCheckOut(array, room);

            Assert.AreEqual(null, newArray);
            //When the guest checkOut room should be availability
        }