static void Main(string[] args) { TestSuite suite = new TestSuite(); suite.add(TestCase.CreateSuite(typeof(TestCaseTest))); suite.add(TestCase.CreateSuite(typeof(AssertTest))); TestResult result = new TestResult(); suite.run(result); Console.WriteLine(result.summary()); }
public void testSuite() { TestSuite suite = new TestSuite(); suite.add(new WasRun("testMethod")); suite.add(new WasRun("testBrokenMethod")); suite.run(result); Assert.AreEqual("2 run, 1 failed", result.summary()); }
public static TestSuite CreateSuite(Type type) { TestSuite suite = new TestSuite(); MethodInfo[] methodInfos = type.GetMethods(BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.Public); foreach (MethodInfo methodInfo in methodInfos) { if (methodInfo.Name != "setUp" && methodInfo.Name != "tearDown") { suite.add((TestCase)type.GetConstructor(new Type[] { typeof(string) }).Invoke(new object[] { methodInfo.Name })); } } return suite; }