static void Main(string[] args) { if (args.Length != 1) { Console.WriteLine("Specify test assembly is parameter"); return; } var location = args.First(); var ai = new AssemblyInspector(location); var classes = ai.GetClasses(); int apassed = 0, afailed = 0; foreach (var c in classes) { var runner = new TestRunner(c); Console.WriteLine(c.Name); var ci = new ClassInspector(c); if (!ExecuteIfExists(runner, ci.GetClassInitialize())) { break; } var testinit = ci.GetTestInitialize(); var testclean = ci.GetTestCleanUp(); var methods = ci.GetMethods(); int cpassed = 0, cfailed = 0; foreach (var m in methods) { if (!ExecuteIfExists(runner, testinit)) { break; } ExecuteTest(ref apassed, ref afailed, runner, ref cpassed, ref cfailed, m); ExecuteIfExists(runner, testclean); } ExecuteIfExists(runner, ci.GetClassCleanUp()); Console.WriteLine(" [{0}] Tests passed: {1}, tests failed: {2}", c.Name, cpassed, cfailed); } Console.WriteLine("Tests passed: {0}, tests failed: {1}", apassed, afailed); }
public void TestMethod1() { var inspector = new ClassInspector(typeof(TestDemoClass)); IEnumerable<MethodInfo> methods = inspector.GetMethods(); Assert.IsNotNull(methods); Assert.AreEqual(6, methods.Count()); }
public void TestGetTestInitialize() { var inspector = new ClassInspector(typeof(TestDemoClass)); MethodInfo m = inspector.GetTestInitialize(); Assert.IsNotNull(m); Assert.AreEqual("TestInit", m.Name); }
public void TestGetClassCleanup() { var inspector = new ClassInspector(typeof(TestDemoClass)); MethodInfo m = inspector.GetClassCleanUp(); Assert.IsNotNull(m); Assert.AreEqual("ClassClean", m.Name); }