public void Has_no_game_objects() { var gameObjects = InMemoryGameObjects.Empty(); var entity = new Guid("39de7404-4ac8-427a-9943-7a215ddc470b"); Assert.IsNull(gameObjects.GameObjectForEntity(entity)); }
public void Does_not_support_a_null_dictionary() { Dictionary <Guid, GameObject> initialGameObjects = null; Assert.Throws <ArgumentNullException>(() => { InMemoryGameObjects.From(initialGameObjects); }); }
public void That_does_not_have_one_returns_the_empty_guid() { var gameObjects = InMemoryGameObjects.Empty(); var gameObject = new GameObject(); var entity = gameObjects.EntityForGameObject(gameObject); Assert.AreEqual( Guid.Empty, entity); }
public void Does_not_support_a_null_game_object() { var gameObjects = InMemoryGameObjects.Empty(); GameObject gameObject = null; Assert.Throws <ArgumentNullException>(() => { gameObjects.EntityForGameObject(gameObject); }); }
public void Does_not_support_a_null_game_object() { var entity = new Guid("166db526-42e6-4fdb-b4c3-212b5efed10e"); GameObject gameObject = null; var gameObjects = InMemoryGameObjects.Empty(); Assert.Throws <ArgumentNullException>(() => { gameObjects.AddGameObjectForEntity( gameObject, entity); }); }
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_does_not_have_one_uses_that_game_object_for_that_entity() { var entity = new Guid("166db526-42e6-4fdb-b4c3-212b5efed10e"); var gameObject = new GameObject(); var gameObjects = InMemoryGameObjects.Empty(); Assert.IsNull(gameObjects.GameObjectForEntity(entity)); gameObjects.AddGameObjectForEntity( gameObject, entity); Assert.AreEqual( gameObject, gameObjects.GameObjectForEntity(entity)); Assert.AreEqual( entity, gameObjects.EntityForGameObject(gameObject)); }
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); }); }