Exemplo n.º 1
0
        TDF.TestRunState run(TDF.ITestListener testListener, Assembly testAssembly, string where)
        {
            string      assemblyFile = new Uri(testAssembly.EscapedCodeBase).LocalPath;
            TestPackage package      = new TestPackage(assemblyFile);

            package.AddSetting("ProcessModel", "InProcess");
            package.AddSetting("DomainUsage", "None");

            ITestRunner runner = engine.GetRunner(package);

            var filterService          = engine.Services.GetService <ITestFilterService>();
            ITestFilterBuilder builder = filterService.GetTestFilterBuilder();

            if (!string.IsNullOrEmpty(where))
            {
                builder.SelectWhere(where);
            }

            var filter = builder.GetFilter();

            var testRunnerName = getTestRunnerName(testAssembly);
            var eventHandler   = new TestEventListener(testListener, testRunnerName);

            XmlNode result = runner.Run(eventHandler, filter);

            return(eventHandler.TestRunState);
        }
Exemplo n.º 2
0
        public TDF.TestRunState RunMember(TDF.ITestListener testListener, Assembly assembly, MemberInfo member)
        {
            var where = Utilities.GetWhereForTarget(assembly, member);
            if (string.IsNullOrEmpty(where))
            {
                return(TDF.TestRunState.NoTests);
            }

            return(run(testListener, assembly, where));
        }
Exemplo n.º 3
0
 public TDF.TestRunState RunNamespace(TDF.ITestListener testListener, Assembly assembly, string ns)
 {
     var where = Utilities.GetWhereForTarget(assembly, ns);
     return(run(testListener, assembly, where));
 }
Exemplo n.º 4
0
 public TDF.TestRunState RunAssembly(TDF.ITestListener testListener, Assembly assembly)
 {
     return(run(testListener, assembly, null));
 }
Exemplo n.º 5
0
 public TestEventListener(TDF.ITestListener testListener, string testRunnerName)
 {
     this.testListener   = testListener;
     this.testRunnerName = testRunnerName;
     TestRunState        = TDF.TestRunState.Success;
 }