public void That_does_have_one_uses_that_game_object_for_that_entity() { var entity = new Guid("166db526-42e6-4fdb-b4c3-212b5efed10e"); var initialGameObject = new GameObject(); var initialGameObjects = new Dictionary <Guid, GameObject> { { entity, initialGameObject } }; var gameObjects = InMemoryGameObjects.From(initialGameObjects); Assert.AreEqual( initialGameObject, gameObjects.GameObjectForEntity(entity)); Assert.AreEqual( entity, gameObjects.EntityForGameObject(initialGameObject)); var newGameObject = new GameObject(); gameObjects.AddGameObjectForEntity( newGameObject, entity); Assert.AreEqual( newGameObject, gameObjects.GameObjectForEntity(entity)); Assert.AreEqual( entity, gameObjects.EntityForGameObject(newGameObject)); }
public void Does_not_support_a_null_dictionary() { Dictionary <Guid, GameObject> initialGameObjects = null; Assert.Throws <ArgumentNullException>(() => { InMemoryGameObjects.From(initialGameObjects); }); }
public BodiesComponent( Dictionary <Guid, float> initialMovementSpeeds, Dictionary <Guid, Vector3> initialBodies, Dictionary <Guid, GameObject> initialGameObjects) { movementSpeeds = InMemoryMovementSpeeds.From(initialMovementSpeeds); bodies = InMemoryBodies.From(initialBodies); gameObjects = InMemoryGameObjects.From(initialGameObjects); }
public void Includes_the_game_objects_in_that_dictionary() { var entity = new Guid("9713e6be-f68d-45af-856d-47d6229eff79"); var gameObject = new GameObject(); var initialGameObjects = new Dictionary <Guid, GameObject> { { entity, gameObject } }; var gameObjects = InMemoryGameObjects.From(initialGameObjects); Assert.AreEqual( gameObject, gameObjects.GameObjectForEntity(entity)); }
public void That_is_already_used_by_an_entity_is_not_supported() { var initialEntity = new Guid("166db526-42e6-4fdb-b4c3-212b5efed10e"); var initialGameObject = new GameObject(); var initialGameObjects = new Dictionary <Guid, GameObject> { { initialEntity, initialGameObject } }; var gameObjects = InMemoryGameObjects.From(initialGameObjects); var newEntity = new Guid("6eb2d86d-42bc-47ce-a161-a8ad28067bb2"); Assert.Throws <InvalidOperationException>(() => { gameObjects.AddGameObjectForEntity( initialGameObject, newEntity); }); }