internal static IList<Test> LoadAll()
{
var file = new FileInfo("tests.xml");
if (!file.Exists)
return new Test[0];
XmlDocument xml = new XmlDocument();
using (var fs = file.OpenRead())
xml.Load(fs);
var ret = new List<Test>();
foreach (XmlNode node in xml.SelectNodes("/Tests/*"))
{
var n = node.SelectSingleNode("./Type");
if (n == null)
throw new InvalidOperationException("Test Type must be informed.");
var typeName = n.InnerText;
var type = FindType(typeName);
if (type == null)
throw new InvalidOperationException(string.Format("'{0}' is not a valid Test.", typeName));
var obj = (Test)Activator.CreateInstance(type);
node.ToEntity(obj);
ret.Add(obj);
}
return ret;
}