Exemplo n.º 1
0
        public void SimulationTickClientsDoRegisterWithSimTicks(int clientCount)
        {
            // Create default tick core
            new CoreTick(TickSystemConstructionUtility.BlankCoreTickSystemConfigData());

            // Create and regster clients
            for (int i = 0; i < clientCount; i++)
            {
                DemoSimulationTickClientInstanceRegistrationTest thisClient =
                    new DemoSimulationTickClientInstanceRegistrationTest();
                thisClient.RegisterTickClient();
            }

            // Tick once to ready client additions
            Core.Tick.OnUpdate(TickSystemConstructionUtility.blankSimTickRate);

            Assert.AreEqual(GetTotalNumberOfSimulationTickSubscribers(), clientCount,
                            "Subscriber count for simulation ticksets do not match number of registrants.");
        }
Exemplo n.º 2
0
        public void SimulationTickClientsDoUnregisterCorrectly()
        {
            // Create default tick core
            new CoreTick(TickSystemConstructionUtility.BlankCoreTickSystemConfigData());

            // Register clients
            Random r        = new Random();
            int    subCount = r.Next(10, 20);
            List <DemoSimulationTickClientInstanceRegistrationTest> clients =
                new List <DemoSimulationTickClientInstanceRegistrationTest>();

            for (int i = 0; i < subCount; i++)
            {
                DemoSimulationTickClientInstanceRegistrationTest thisClient =
                    new DemoSimulationTickClientInstanceRegistrationTest();
                thisClient.RegisterTickClient();
                clients.Add(thisClient);
            }

            // Tick once to ready client additions
            Core.Tick.OnUpdate(TickSystemConstructionUtility.blankSimTickRate);

            // Unrgister clients
            int remCount = r.Next(3, 8);

            for (int i = 0; i < remCount; i++)
            {
                clients[i].UnregisterTickClient();
            }

            // Tick once to ready client subtractions
            Core.Tick.OnUpdate(TickSystemConstructionUtility.blankSimTickRate);

            Assert.AreEqual(GetTotalNumberOfSimulationTickSubscribers(), subCount - remCount,
                            "Subscriber count for render ticksets do not match number of registrants.");
        }