Skip to content

Instantly share code, notes, and snippets.

@einarwh
Created June 14, 2012 19:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save einarwh/2932365 to your computer and use it in GitHub Desktop.
Save einarwh/2932365 to your computer and use it in GitHub Desktop.
A test group is basically just a facade for the test class.
namespace Mjunit
{
class TestGroup : IEnumerable
{
private readonly Type _testClass;
private readonly ArrayList _testMethods = new ArrayList();
public TestGroup(Type testClass)
{
_testClass = testClass;
var methods = _testClass.GetMethods();
for (int i = 0; i < methods.Length; i++)
{
var m = methods[i];
if (m.Name.Substring(0, 4) == "Test" &&
m.ReturnType == typeof(void))
{
_testMethods.Add(m);
}
}
}
public Type TestClass
{
get { return _testClass; }
}
public int NumberOfTests
{
get { return _testMethods.Count; }
}
public IEnumerator GetEnumerator()
{
return _testMethods.GetEnumerator();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment