Ejemplo n.º 1
0
        TestRunState ITdNetTestRunner.RunNamespace(ITestListener listener, Assembly assembly, string ns)
        {
            try
            {
                using (ExecutorWrapper wrapper = new ExecutorWrapper(new Uri(assembly.CodeBase).LocalPath, null, false))
                {
                    TdNetLogger  logger   = new TdNetLogger(listener, assembly);
                    TestRunner   runner   = new TestRunner(wrapper, logger);
                    TestRunState runState = TestRunState.NoTests;

                    foreach (Type type in assembly.GetExportedTypes())
                    {
                        if (ns == null || type.Namespace == ns)
                        {
                            runState = TestResultMapper.Merge(runState, RunClass(runner, type));
                        }
                    }

                    return(runState);
                }
            }
            catch (ArgumentException)
            {
                return(TestRunState.NoTests);
            }
        }
Ejemplo n.º 2
0
        public static TestRunState RunClassWithInnerTypes(TestRunner runner, Type type)
        {
            TestRunState result = RunClass(runner, type);

            foreach (MemberInfo memberInfo in type.GetMembers())
            {
                Type childType = memberInfo as Type;

                if (childType != null)
                {
                    result = TestResultMapper.Merge(result, RunClassWithInnerTypes(runner, childType));
                }
            }

            return(result);
        }
Ejemplo n.º 3
0
        public static TestRunState RunAssembly(TestRunner runner)
        {
            TestRunnerResult result = runner.RunAssembly();

            return(TestResultMapper.Map(result));
        }
Ejemplo n.º 4
0
        public static TestRunState RunMethod(TestRunner runner, MethodInfo method)
        {
            TestRunnerResult result = runner.RunTest(method.ReflectedType.FullName, method.Name);

            return(TestResultMapper.Map(result));
        }
Ejemplo n.º 5
0
        public static TestRunState RunClass(TestRunner runner, Type type)
        {
            var result = runner.RunClass(type.FullName);

            return(TestResultMapper.Map(result));
        }