Пример #1
0
        public void TestLotsOfEntities()
        {
            int numEntities = 10000;
            int numSteps    = 500;

            var entities = new List <SimpleEntity>();

            for (int i = 0; i < numEntities; i++)
            {
                entities.Add(new SimpleEntity(i, entities));
            }

            foreach (var e in entities)
            {
                e.Start(Scheduler);
            }

            long timeStart = Time.Ticks;

            for (int j = 0; j < numSteps; j++)
            {
                Scheduler.Step();
            }

            long     timeEnd = Time.Ticks;
            TimeSpan elapsed = new TimeSpan(timeEnd - timeStart);

            foreach (var e in entities)
            {
                Assert.AreEqual(numSteps, e.NumSteps);
            }

            Console.WriteLine("Took {0:N2} secs for {1} iterations. {2:N1} entities/sec", elapsed.TotalSeconds, numSteps, numEntities * numSteps / elapsed.TotalSeconds);
        }
Пример #2
0
        public void BasicTest()
        {
            var future = Scheduler.Start(TaskReturn5());

            Scheduler.Step();
            Assert.AreEqual(5, future.Result);
        }