public TestLib(string name, int randomSeed)
{
global = new TestNamespace("Global");
random = (randomSeed < 0) ? null : new System.Random(randomSeed);
if (random != null)
{
System.Console.WriteLine("Test cases order is shuffled using seed: {0}", randomSeed);
}
var lib = System.Reflection.Assembly.LoadFile(name);
System.Type[] classes = lib.GetTypes();
System.Array.Sort(classes, CompareTypesByName);
foreach (System.Type type in classes)
{
if (type.IsClass)
{
var attrs = Reflection.GetAttributes(type, typeof(NUnit.Framework.TestFixtureAttribute), false);
if (attrs.Count() == 1)
{
global.Add(type.FullName, type, null);
}
else
{
foreach (var attr in attrs)
{
var arguments = Reflection.GetProperty(attr, "Arguments") as object[];
global.Add(type.FullName + "." + MethodHelper.GetDisplayName(type.GetConstructor(MethodHelper.GetArgumentTypes(arguments)), arguments), type, arguments);
}
}
}
}
}