示例#1
0
文件: Spec.cs 项目: andrakis/nodecs
        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);
            }
        }
示例#2
0
文件: Spec.cs 项目: andrakis/nodecs
 public void RunSpec(SpecDone onDone)
 {
     this._Spec();
     this.run(onDone);
 }
示例#3
0
文件: Spec.cs 项目: andrakis/nodecs
 public void run(SpecDone onDone)
 {
     this.callback(delegate(object result)
     {
         this.result = result;
         onDone(this);
     });
 }