Exemple #1
0
        public void AddGuestToCheckOut()
        {
            Lobby     lobby = new Lobby(1, new Point(0, 0), new Point(1, 1));
            GuestRoom room  = new GuestRoom(2, new Point(1, 0), new Point(1, 1), 1);

            lobby.Neighbors.Add(Direction.East, room);
            room.Neighbors.Add(Direction.West, lobby);

            Receptionist receptionist = new Receptionist(lobby, new List <Room>()
            {
                lobby, room
            });

            Guest guest = new Guest(lobby);

            guest.Classification = 1;

            lobby.CheckIn(guest);

            for (int i = 0; i < 10; i++)
            {
                receptionist.Update(1);
            }

            guest.FindAndTargetRoom(x => x is Lobby && (x as Lobby).Receptionist != null);
            guest.StayState = StayState.CheckOut;

            for (int i = 0; i < 10; i++)
            {
                guest.Update(1);
                receptionist.Update(1);
            }

            Assert.IsTrue(guest.Room == null);
        }
Exemple #2
0
        public void RemoveGuestFromLobbyQueue()
        {
            Lobby     lobby = new Lobby(1, new Point(0, 0), new Point(1, 1));
            GuestRoom room  = new GuestRoom(2, new Point(1, 0), new Point(1, 1), 1);

            lobby.Neighbors.Add(Direction.East, room);
            room.Neighbors.Add(Direction.West, lobby);

            Receptionist receptionist = new Receptionist(lobby, new List <Room>()
            {
                lobby, room
            });

            Guest guest = new Guest(lobby);

            guest.Classification = 1;

            lobby.CheckIn(guest);

            lobby.RemoveFromQueues(guest);

            for (int i = 0; i < 10; i++)
            {
                receptionist.Update(1);
            }

            Assert.IsTrue(guest.Room == null);
        }
Exemple #3
0
        public void GuestCantCheckin()
        {
            Lobby        lobby        = new Lobby(1, new Point(0, 0), new Point(1, 1));
            Receptionist receptionist = new Receptionist(lobby, new List <Room>()
            {
                lobby
            });

            Guest guest = new Guest(lobby);

            guest.Classification = 1;

            lobby.CheckIn(guest);
            receptionist.Update(1);
            Assert.IsTrue(guest.StayState == StayState.None);
        }