using System; using System.Collections.Generic; using System.Text; using BlogRunner.Core.Config; using System.IO; namespace BlogRunner.Core { public interface ITestResults { void AddResult(string key, string value); } public class TestResultImpl : ITestResults { public delegate void Func(string key, string val); private Dictionary results = new Dictionary(); public void AddResult(string key, string value) { results.Add(key, value); } public void ForEach(Func func) { List keys = new List(results.Keys); keys.Sort(StringComparer.CurrentCultureIgnoreCase); foreach (string key in keys) { func(key, results[key]); } } public void Dump(TextWriter output) { ForEach((key, value) => { output.WriteLine(string.Format("{0}: {1}", key, value)); }); } } }