public void ShouldNotFindRemovedEntity() { var spatialMap = new NaiveSpatialDictionary <IPlayer>(); var searchPoint = new Point(50, 50); var player = Container.Resolve <IPlayer>(); player.Location = new Point(51, 51); spatialMap.Add(player); // First verify that we can find the player initially. Assert.True(spatialMap.GetObjectsInProximity(searchPoint, 40).Contains(player)); // Now remove the player... spatialMap.Remove(player); // And verify it isn't returned after removal. Assert.False(spatialMap.GetObjectsInProximity(searchPoint, 40).Contains(player)); }
public void ShouldReturnEntityWithinSearchRange(short x, short y, int dist, bool shouldBeReturned) { var spatialMap = new NaiveSpatialDictionary <IPlayer>(); var searchPoint = new Point(50, 50); var player = Container.Resolve <IPlayer>(); player.Location = new Point(x, y); spatialMap.Add(player); var results = spatialMap.GetObjectsInProximity(searchPoint, dist); Assert.Equal(shouldBeReturned, results.Contains(player)); }