public void WorldSelector_ActiveWorld_will_be_non_null_if_spatial_worlds() { using (var mockWorld = MockWorld.Create(new MockWorld.Options())) { var element = new WorldSelector(); element.UpdateWorldSelection(); Assert.IsNotNull(element.ActiveWorld); Assert.AreEqual(mockWorld.Worker.World, element.ActiveWorld); } }
public void Disposed_world_cleans_provider() { using (var mockWorld = MockWorld.Create(new MockWorld.Options())) { mockWorld.Step(world => { world.Connection.CreateEntity(entityId, GetTemplate()); }); Assert.AreEqual(1, ReferenceProvider <string> .Count); } Assert.AreEqual(0, ReferenceProvider <string> .Count); }
public void WorldSelector_OnWorldChanged_called_when_world_changed() { using (MockWorld.Create(new MockWorld.Options())) { var element = new WorldSelector(); var changed = false; element.OnWorldChanged += world => changed = true; element.UpdateWorldSelection(); Assert.IsTrue(changed); } }
public void Removed_component_disposes_reference() { var template = GetTemplate(); using (var mockWorld = MockWorld.Create(new MockWorld.Options())) { mockWorld .Step(world => { world.Connection.CreateEntity(entityId, template); }) .Step(world => { Assert.AreEqual(1, ReferenceProvider <string> .Count); world.Connection.RemoveEntityAndComponents(entityId, template); }); Assert.AreEqual(0, ReferenceProvider <string> .Count); } }