public void GetListOfEmptyRooms()
        {
            // Arrange
            IRoomAccess service = new RoomAccess();
            service.GenerateBasicHotel(3, 2, 3);

            var guest1 = new Guest(fname: "Some", lname: "Body");
            string roomNumber1 = service.GetRoomNumbers()[4];
            service.AssignGuestToRoom(guest1, roomNumber1);

            var guest2 = new Guest(fname: "Noone", lname: "Special");
            string roomNumber2 = service.GetRoomNumbers()[3];
            service.AssignGuestToRoom(guest2, roomNumber2);

            var guest3 = new Guest(fname: "Short", lname: "Timer");
            string roomNumber3 = service.GetRoomNumbers()[5];
            service.AssignGuestToRoom(guest3, roomNumber3);
            service.UnassignGuestFromRoom(guest3, roomNumber3);

            // Act
            List<Room> list = service.GetAllEmptyRooms();

            // Assert
            Assert.AreEqual(3*2*3 - 2, list.Count, "Expected number of empty rooms incorrect");
            Assert.IsTrue(list.All(room => room.Guest == null), "Not all rooms returned are empty");
        }
        public void GetListOfGuests()
        {
            // Arrange
            IRoomAccess service = new RoomAccess();
            service.GenerateBasicHotel(3, 2, 3);

            var guest1 = new Guest(fname: "Some", lname: "Body");
            string roomNumber1 = service.GetRoomNumbers()[4];
            service.AssignGuestToRoom(guest1, roomNumber1);

            var guest2 = new Guest(fname: "Noone", lname: "Special");
            string roomNumber2 = service.GetRoomNumbers()[3];
            service.AssignGuestToRoom(guest2, roomNumber2);

            var guest3 = new Guest(fname: "Short", lname: "Timer");
            string roomNumber3 = service.GetRoomNumbers()[5];
            service.AssignGuestToRoom(guest3, roomNumber3);
            service.UnassignGuestFromRoom(guest3, roomNumber3);

            // Act
            List<Guest> list = service.GetGuestList();

            // Assert
            Assert.AreEqual(2, list.Count);
            Assert.AreEqual(1, list.FindAll(guest => guest.FirstName == "Some" && guest.LastName == "Body").Count);
            Assert.AreEqual(1, list.FindAll(guest => guest.FirstName == "Noone" && guest.LastName == "Special").Count);
        }
        public void Generated1DimensionalHotelHasUniqueRoomNumbers()
        {
            // Arrange
            IRoomAccess service = new RoomAccess();
            const uint x = 10;
            const uint y = 1;
            const uint z = 1;

            // Act
            service.GenerateBasicHotel(x, y, z);

            // Assert
            VerifyThatHotelHasUniqueRoomNumbers(RoomAccess.HotelMap);
        }
        public void Generate3DimensionalHotel()
        {
            // Arrange
            IRoomAccess service = new RoomAccess();
            const uint x = 10;
            const uint y = 10;
            const uint z = 10;

            // Act
            service.GenerateBasicHotel(x, y, z);

            // Assert
            Assert.AreEqual((int) (x*y*z), RoomAccess.HotelMap.Count);
        }
        public void CheckInGuestIntoNonExistantRoom()
        {
            // Arrange
            IRoomAccess service = new RoomAccess();
            service.GenerateBasicHotel(2, 2, 2);
            var guest = new Guest(fname: "Some", lname: "Body");
            string roomNumber = "IAmNotARoom";

            // Act
            service.AssignGuestToRoom(guest, roomNumber);

            // Assert
            Assert.Fail("Expected exception was not thrown");
        }
        public void CheckInGuestIntoEmptyRoom()
        {
            // Arrange
            IRoomAccess service = new RoomAccess();
            service.GenerateBasicHotel(2, 2, 2);
            var guest = new Guest(fname: "Some", lname: "Body");
            string roomNumber = service.GetRoomNumbers()[4];

            // Act
            service.AssignGuestToRoom(guest, roomNumber);

            // Assert
            Assert.AreEqual("Some", RoomAccess.HotelMap.Find(room => room.RoomNumber == roomNumber).Guest.FirstName, "Assigned guest's first name doesn't match");
            Assert.AreEqual("Body", RoomAccess.HotelMap.Find(room => room.RoomNumber == roomNumber).Guest.LastName, "assigned guest's last name doesn't match");
            Assert.IsTrue(RoomAccess.HotelMap.FindAll(room => room.RoomNumber != roomNumber).TrueForAll(room => room.Guest == null),
                          "Guest assigned to wrong rooms");
        }
        public void CheckOutWrongGuestFromRoom()
        {
            // Arrange
            IRoomAccess service = new RoomAccess();
            service.GenerateBasicHotel(2, 2, 2);

            var guest1 = new Guest(fname: "Some", lname: "Body");
            string roomNumber1 = service.GetRoomNumbers()[4];
            service.AssignGuestToRoom(guest1, roomNumber1);

            var guest2 = new Guest(fname: "Noone", lname: "Special");
            string roomNumber2 = service.GetRoomNumbers()[3];
            service.AssignGuestToRoom(guest2, roomNumber2);

            // Act
            service.UnassignGuestFromRoom(guest2, roomNumber1);

            // Assert
            Assert.Fail("Expected exception was not thrown");
        }
        public void CheckOutGuest()
        {
            // Arrange
            IRoomAccess service = new RoomAccess();
            service.GenerateBasicHotel(2, 2, 2);

            var guest1 = new Guest(fname: "Some", lname: "Body");
            string roomNumber1 = service.GetRoomNumbers()[4];
            service.AssignGuestToRoom(guest1, roomNumber1);

            var guest2 = new Guest(fname: "Noone", lname: "Special");
            string roomNumber2 = service.GetRoomNumbers()[3];
            service.AssignGuestToRoom(guest2, roomNumber2);

            // Act
            service.UnassignGuestFromRoom(guest1, roomNumber1);

            // Assert
            Assert.IsNull(RoomAccess.HotelMap.Find(room => room.RoomNumber == roomNumber1).Guest, "Guest still exists in room");
            Assert.AreEqual("Noone", RoomAccess.HotelMap.Find(room => room.RoomNumber == roomNumber2).Guest.FirstName, "Other Guest was checked out");
        }
        public void GetListOfRoomNumbers()
        {
            // Arrange
            IRoomAccess service = new RoomAccess();
            service.GenerateBasicHotel(10, 10, 10);

            // Act
            List<string> list = service.GetRoomNumbers();

            // Assert
            Assert.AreEqual(10*10*10, list.Count);
        }