Exemple #1
0
            public void RemovesAndReturnsSystemForExistentType()
            {
                EntityWorld target = EmptyWorld();
                var system = new FakeComponent1System();
                target.AddSystem(system);

                Assert.Equal(system, target.RemoveSystem<FakeComponent1System>());
                Assert.Equal(0, target.GetSystems().Count);
            }
Exemple #2
0
            public void ThrowsInvalidOperationForSystemInAnotherWorld()
            {
                EntityWorld target1 = EmptyWorld();
                EntityWorld target2 = EmptyWorld();
                var system = new FakeComponent1System();
                target1.AddSystem(system);

                Assert.Throws<InvalidOperationException>(() => target2.AddSystem(system));
            }
Exemple #3
0
            public void RemovesAndReturnsSystemForExistentType()
            {
                EntityWorld target = EmptyWorld();
                var         system = new FakeComponent1System();

                target.AddSystem(system);

                Assert.Equal(system, target.RemoveSystem <FakeComponent1System>());
                Assert.Empty(target.GetSystems());
            }
Exemple #4
0
            public void ThrowsInvalidOperationForSystemInAnotherWorld()
            {
                EntityWorld target1 = EmptyWorld();
                EntityWorld target2 = EmptyWorld();
                var         system  = new FakeComponent1System();

                target1.AddSystem(system);

                Assert.Throws <InvalidOperationException>(() => target2.AddSystem(system));
            }
Exemple #5
0
            public void IsNotExecutedForComponentOfNoInterest()
            {
                var target = new FakeComponent1System();
                var world = new EntityWorld();
                world.AddSystem(target);
                var component = new FakeComponent2();
                Entity entity = world.CreateEntity();
                entity.AddComponent(component);

                world.Update(TimeSpan.Zero);

                Assert.False(component.Processed);
            }
Exemple #6
0
            public void IsNotExecutedForComponentOfNoInterest()
            {
                var target = new FakeComponent1System();
                var world  = new EntityWorld();

                world.AddSystem(target);
                var    component = new FakeComponent2();
                Entity entity    = world.CreateEntity();

                entity.AddComponent(component);

                world.Update(TimeSpan.Zero);

                Assert.False(component.Processed);
            }
Exemple #7
0
            public void IsNotExecutedForDrawSystemInUpdateLoop()
            {
                var target = new FakeComponent1System();
                var world  = new EntityWorld();

                world.AddSystem(target);
                var    component = new FakeComponent1();
                Entity entity    = world.CreateEntity();

                entity.AddComponent(component);

                world.Draw();

                Assert.False(component.Processed);
            }
Exemple #8
0
            public void IsNotExecutedForDrawSystemInUpdateLoop()
            {
                var target = new FakeComponent1System();
                var world = new EntityWorld();
                world.AddSystem(target);
                var component = new FakeComponent1();
                Entity entity = world.CreateEntity();
                entity.AddComponent(component);

                world.Draw();

                Assert.False(component.Processed);
            }