Exemple #1
0
        public void SimpleCounter()
        {
            temp = 0;
            Delegating task = new Delegating(sim,
                                             new DelegatingTaskHandler(CountUsingTemp));

            sim.Run(new Task [] { task });
            Assert.AreEqual(10, (int)temp);
        }
Exemple #2
0
        public void RunAndGetMessage()
        {
            Delegating task = new Delegating(sim,
                                             new DelegatingTaskHandler(SetMessageViaTemp));

            sim.Run(new Task [] { task });
            Assert.AreEqual("Hello", temp);
            Assert.AreEqual(0L, sim.Now);
        }
Exemple #3
0
        private bool CountUsingTemp(Delegating task, object activator,
                                    object data)
        {
            int i = (int)temp;

            i++;
            temp = i;
            if (i < 10)
            {
                task.Activate(null, i * 100);
            }

            return(i >= 10);
        }
Exemple #4
0
 private bool SetMessageViaTemp(Delegating task, object activator,
                                object data)
 {
     temp = "Hello";
     return(true);
 }