public void GetObjectsInCellsAroundPoint() { WorldGrid grid = GetPopulatedWorldGrid(); // Set A { int[] ids = new int[] { 4, 5, 6, 8, 9 }; List <Entity> objs = grid.GetObjectsInCellsAroundPoint( new Point(450, 450) ); objs.OrderBy(entity => entity.Id); Assert.Equal(ids.Length, objs.Count); for (int i = 0; i < ids.Length; i++) { Assert.Equal(ids[i], objs[i].Id); } } // Set B { int[] ids = new int[] { 0, 1, 4, 5, 6 }; List <Entity> objs = grid.GetObjectsInCellsAroundPoint( new Point(300, 300) ); objs.OrderBy(entity => entity.Id); Assert.Equal(ids.Length, objs.Count); for (int i = 0; i < ids.Length; i++) { Assert.Equal(ids[i], objs[i].Id); } } // Set C { int[] ids = new int[] { 0, 4 }; List <Entity> objs = grid.GetObjectsInCellsAroundPoint( new Point(100, 100) ); objs.OrderBy(entity => entity.Id); Assert.Equal(ids.Length, objs.Count); for (int i = 0; i < ids.Length; i++) { Assert.Equal(ids[i], objs[i].Id); } } }