Esempio n. 1
0
        public void Has_no_game_objects()
        {
            var gameObjects = InMemoryGameObjects.Empty();
            var entity      = new Guid("39de7404-4ac8-427a-9943-7a215ddc470b");

            Assert.IsNull(gameObjects.GameObjectForEntity(entity));
        }
Esempio n. 2
0
        public void Does_not_support_a_null_dictionary()
        {
            Dictionary <Guid, GameObject> initialGameObjects = null;

            Assert.Throws <ArgumentNullException>(() =>
            {
                InMemoryGameObjects.From(initialGameObjects);
            });
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        public void Does_not_support_a_null_game_object()
        {
            var        gameObjects = InMemoryGameObjects.Empty();
            GameObject gameObject  = null;

            Assert.Throws <ArgumentNullException>(() =>
            {
                gameObjects.EntityForGameObject(gameObject);
            });
        }
Esempio n. 5
0
        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);
            });
        }
Esempio n. 6
0
        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));
        }
Esempio n. 7
0
        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));
        }
Esempio n. 8
0
        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);
            });
        }