Created
June 14, 2012 19:23
-
-
Save einarwh/2932365 to your computer and use it in GitHub Desktop.
A test group is basically just a facade for the test class.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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