public void AddedEntityAmongNoOtherEntitiesWillNotBeFoundByWrongPosition() { Entity entityInPosition; int id = 1; WorldGrid worldGrid = new WorldGrid(); Vector3 position = new Vector3(0.0f, 0.0f, 0.0f); worldGrid.AddEntity(new Sphere(id, position, Color.Black)); entityInPosition = worldGrid.GetEntityByVoxelPosition(new IntVector(1, 0, 0)); Assert.IsNull(entityInPosition); }
public void AddedEntityAmongNoOtherEntitiesWillBeFoundByFractionalPosition() { Entity entityInPosition; int id = 1; WorldGrid worldGrid = new WorldGrid(); Vector3 position = new Vector3(1.9f, 0.5f, -3.6f); worldGrid.AddEntity(new Sphere(id, position, Color.Black)); entityInPosition = worldGrid.GetEntityByVoxelPosition((IntVector)position); Assert.IsNotNull(entityInPosition, "No entity was found at the position"); Assert.AreEqual <Vector3>(position, entityInPosition.GetPosition(), "The added and the found entity did not have the same position."); Assert.AreEqual <int>(id, entityInPosition.GetIndex(), "The added and the found entity did not have the same index."); }