public void TestAddRoom(int x, int y) { LevelLayout layout = new LevelLayout(); Vector2Int location = new Vector2Int(x, y); IRoom room = layout.AddRoom(location); Assert.AreEqual(location, room.Position); Assert.AreEqual(room, layout.GetRoom(location)); }
public void TestConnectRoomsRedundant() { LevelLayout layout = new LevelLayout(); Vector2Int loc1 = Vector2Int.zero; Vector2Int loc2 = Vector2Int.right; bool[] expected1 = new bool[4]; expected1[(int)Direction.Right] = true; bool[] expected2 = new bool[4]; expected2[(int)Direction.Left] = true; layout.AddRoom(loc1); layout.AddRoom(loc2); layout.ConnectRooms(loc1, loc2); layout.ConnectRooms(loc1, loc2); Assert.IsTrue(expected1.SequenceEqual(layout.GetRoom(loc1).Openings)); Assert.IsTrue(expected2.SequenceEqual(layout.GetRoom(loc2).Openings)); }
public void TestConnectRoomsValid( int x1, int y1, int x2, int y2, Direction dirFrom1, Direction dirFrom2 ) { LevelLayout layout = new LevelLayout(); Vector2Int loc1 = new Vector2Int(x1, y1); //Vector2Int.zero; Vector2Int loc2 = new Vector2Int(x2, y2); //Vector2Int.right; bool[] expected1 = new bool[(int)Direction.Count]; expected1[(int)dirFrom1] = true; bool[] expected2 = new bool[(int)Direction.Count]; expected2[(int)dirFrom2] = true; layout.AddRoom(loc1); layout.AddRoom(loc2); layout.ConnectRooms(loc1, loc2); Assert.IsTrue(expected1.SequenceEqual(layout.GetRoom(loc1).Openings)); Assert.IsTrue(expected2.SequenceEqual(layout.GetRoom(loc2).Openings)); }