示例#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);
            }
示例#2
0
            public void ThrowsInvalidOperationForSystemInAnotherWorld()
            {
                EntityWorld target1 = EmptyWorld();
                EntityWorld target2 = EmptyWorld();
                var system = new FakeComponent1System();
                target1.AddSystem(system);

                Assert.Throws<InvalidOperationException>(() => target2.AddSystem(system));
            }
示例#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());
            }
示例#4
0
            public void ThrowsInvalidOperationForSystemInAnotherWorld()
            {
                EntityWorld target1 = EmptyWorld();
                EntityWorld target2 = EmptyWorld();
                var         system  = new FakeComponent1System();

                target1.AddSystem(system);

                Assert.Throws <InvalidOperationException>(() => target2.AddSystem(system));
            }
示例#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);
            }
示例#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);
            }
示例#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);
            }
示例#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);
            }