Beispiel #1
0
        public void SystemSendingMessagesStressTest()
        {
            int expectedMessages = 500;
            var world            = new World();
            var system           = new TestSystem(world);

            for (int i = 0; i < expectedMessages; i++)
            {
                world.SendMessage(new TestMessage());
            }

            Thread.Sleep(1000);

            Assert.AreEqual(system.MessagesReceived, expectedMessages);
        }
Beispiel #2
0
        public void SystemAddingCompositionsAsIntended()
        {
            var world  = new World();
            var system = new TestSystem(world);

            var entity1 = world.CreateEntity()
                          .AddComponent <TestComponent1>()
                          .AddComponent <TestComponent2>()
                          .AddToWorld();

            var entity2 = world.CreateEntity()
                          .AddComponent <TestComponent1>()
                          .AddComponent <TestComponent2>()
                          .AddToWorld();

            var entity3 = world.CreateEntity()
                          .AddComponent <TestComponent1>()
                          .AddToWorld();

            Assert.AreEqual(2, system.EntityCount);
        }
Beispiel #3
0
        public void SystemComponentInterestsWorkingNegative()
        {
            TestSystem testSystem = new TestSystem(new World());

            Assert.AreEqual(testSystem.InterestedIn(new Type[] { typeof(TestComponent1), typeof(TestComponent3) }), false);
        }