static void Main(string[] args) { List <Room> Rooms = new List <Room>(); HostelRoomFactory hostelRoomFactory = new HostelRoomFactory(); HotelRoomFactory hotelRoomFactory = new HotelRoomFactory(); for (int i = 0; i < 5; i++) { if (i % 2 == 0) { Rooms.Add(hostelRoomFactory.CreateRoom(2, i * 100)); } else { Rooms.Add(hostelRoomFactory.CreateRoom(1, i * 50)); } } for (int i = 0; i < 5; i++) { Rooms.Add(hotelRoomFactory.CreateRoom((byte)(i + 3), i * 100)); } foreach (var room in Rooms) { Console.WriteLine(room); } Console.ReadKey(); }
public void CreateRoomObjectWithFactory_OfTypeRoom_IsInstanceOfType() { // Arramge Hotel hotel = new Hotel(); RoomObject roomObject = new RoomObject(); HotelRoomFactory hotelRoomFactory = new HotelRoomFactory(); HotelNode hotelNode = new HotelNode(roomObject, 0); roomObject.AreaType = "Room"; // Act hotelNode.HotelObject = hotelRoomFactory.HotelRooms(hotelNode); // Assert Assert.IsInstanceOfType(hotelNode.HotelObject, typeof(Room)); }
public void DijkstraPathfinding_OfTypeHotelNode_AreEqual() { // Arrange List <HotelNode> hotelNodes = new List <HotelNode>(); HotelRoomFactory hotelRoomFactory = new HotelRoomFactory(); List <HotelNode> expected = new List <HotelNode>(); RoomObject startObject = new RoomObject() { Classification = "1 Star", ID = 11, AreaType = "Room", Position = new Point(7, 1), Dimension = new Point(1, 1) }; RoomObject endObject = new RoomObject() { Classification = "5 stars", ID = 12, AreaType = "Room", Position = new Point(6, 1), Dimension = new Point(2, 1) }; HotelNode startHotelNode = new HotelNode(startObject, 0); HotelNode endHotelNode = new HotelNode(endObject, 0); Dictionary <string, string> data = new Dictionary <string, string>(); // Act startHotelNode.HotelObject = hotelRoomFactory.HotelRooms(startHotelNode); endHotelNode.HotelObject = hotelRoomFactory.HotelRooms(endHotelNode); hotelNodes.Add(startHotelNode); hotelNodes.Add(endHotelNode); expected.Add(endHotelNode); startHotelNode.RoomNeighbour.Add(new HotelEdge(startHotelNode, endHotelNode)); endHotelNode.RoomNeighbour.Add(new HotelEdge(endHotelNode, startHotelNode)); data.Add("Gast1", "Checkin 5stars"); Guest guest = new Guest(startHotelNode, data, hotelNodes); // Assert Assert.AreEqual(expected[0].RoomData, guest.specificRoomDirections[0].RoomData); }
public void FindSpecificOpenRoom_OfTypeHotelNode_AreEqual() { // Arrange HumanSchematic newGuest = new Guest(null, null, null); List <HotelNode> hotelNodes = new List <HotelNode>(); HotelRoomFactory hotelRoomFactory = new HotelRoomFactory(); RoomObject RandomObject = new RoomObject() { Classification = "1 Star", ID = 11, AreaType = "Room", Position = new Point(7, 1), Dimension = new Point(1, 1) }; RoomObject expectedObject = new RoomObject() { Classification = "4 stars", ID = 25, AreaType = "Room", Position = new Point(3, 2), Dimension = new Point(2, 1) }; HotelNode randomHotelNode = new HotelNode(RandomObject, 0); HotelNode expected = new HotelNode(expectedObject, 0); Dictionary <string, string> Data = new Dictionary <string, string>(); // Act randomHotelNode.HotelObject = hotelRoomFactory.HotelRooms(randomHotelNode); expected.HotelObject = hotelRoomFactory.HotelRooms(expected); hotelNodes.Add(randomHotelNode); hotelNodes.Add(expected); Data.Add("Gast1", "Checkin 4stars"); HotelNode result = newGuest.FindSpecificOpenRoom(Data, hotelNodes); // Assert Assert.AreEqual(expected, result); }