public void SimpleCounter() { temp = 0; Delegating task = new Delegating(sim, new DelegatingTaskHandler(CountUsingTemp)); sim.Run(new Task [] { task }); Assert.AreEqual(10, (int)temp); }
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); }
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); }
private bool SetMessageViaTemp(Delegating task, object activator, object data) { temp = "Hello"; return(true); }