private void run(SpecDone onDone) { // Copy the list of specs List<SpecCallbackEntry> list = this.specs.ToList(); SpecDone processor = null; // Assign to avoid compiler error processor = delegate(object result) { SpecCallbackEntry entry = result as SpecCallbackEntry; System.Collections.Hashtable results = new System.Collections.Hashtable(); results.Add(entry.name, entry.result); onDone(results); if (0 == list.Count) { return; } entry = list[0]; list.RemoveAt(0); // Call ourselves again! entry.run(processor); }; // Run the first to get the ball rolling if (list.Count == 0) { return; } else { SpecCallbackEntry entry = list[0]; list.RemoveAt(0); entry.run(processor); } }
public void RunSpec(SpecDone onDone) { this._Spec(); this.run(onDone); }
public void run(SpecDone onDone) { this.callback(delegate(object result) { this.result = result; onDone(this); }); }