public void GetObjectsWithin_ReturnsCorrectObject() { var grid = new UniversalGrid <string>(10, 20); var thing1 = "A".AsSpatialObject(1, 1); grid.SetObject(thing1); Assert.That(grid.GetObjectsWithin(new Rectangle(0, 0, 5, 5)).Single(), Is.EqualTo(thing1)); }
public void GetObjectsWithin_ReturnsCorrectObjects() { var grid = new UniversalGrid <string>(10, 20); var thing1 = "A".AsSpatialObject(1, 1); var thing2 = "B".AsSpatialObject(1, 2); grid.SetObjects(thing1, thing2); var objs = grid.GetObjectsWithin(new Rectangle(0, 0, 5, 5)).ToList(); Assert.That(objs.First(), Is.EqualTo(thing1)); Assert.That(objs.Skip(1).First(), Is.EqualTo(thing2)); Assert.That(objs.Count, Is.EqualTo(2)); }