public Runner(ITestEngine engine, HostedOptions options)
 {
     _engine = engine;
     _options = options;
     _resultService = _engine.Services.GetService<IResultService>();
     _filterService = _engine.Services.GetService<ITestFilterService>();
 }
 public Runner(ITestEngine engine, HostedOptions options)
 {
     _engine        = engine;
     _options       = options;
     _resultService = _engine.Services.GetService <IResultService>();
     _filterService = _engine.Services.GetService <ITestFilterService>();
 }
        public static TestPackage MakeTestPackage(HostedOptions options)
        {
            TestPackage package = new TestPackage(options.InputFiles);

            package.AddSetting(PackageSettings.RuntimeFramework, "v4.0");

            return(package);
        }
        private bool CreateTestFilter(HostedOptions options, out TestFilter testFilter)
        {
            testFilter = TestFilter.Empty;
            SimpleNameFilter simpleNameFilter = new SimpleNameFilter();

            if (testFilter is NotFilter)
            {
                ((NotFilter)testFilter).TopLevel = true;
            }
            return(true);
        }
Esempio n. 5
0
 public TestEventHandler(HostedOptions options, TextWriter outWriter, Messages.OnMessage[] subscribers)
 {
     this.level                    = 0;
     this.s                        = new ResultSummary();
     this.options                  = options;
     this.outWriter                = outWriter;
     this.currentTestName          = string.Empty;
     this._messageSubscribeAdapter = subscribers != null
         ? new TestMessageSubscriberAdapter(Messages.CombineSubscribers(subscribers))
         : null;
     AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(this.OnUnhandledException);
 }
        public static TestResults Run(HostedOptions options, Messages.OnMessage[] messageSubscribers)
        {
            using (ITestEngine engine = TestEngineActivator.CreateInstance())
            {
                if (options.WorkDirectory != null)
                {
                    engine.WorkDirectory = options.WorkDirectory;
                }

                return(new Runner(engine, options).Execute(messageSubscribers));
            }
        }
        public ResultReporter(XmlNode result, TextWriter writer, HostedOptions options)
        {
            _result = result;
            _writer = writer;

            _overallResult = result.GetAttribute("result");
            if (_overallResult == "Skipped")
                _overallResult = "Warning";

            _options = options;

            Summary = ReadResultSummary(result);
        }
        public ResultReporter(XmlNode result, TextWriter writer, HostedOptions options)
        {
            _result = result;
            _writer = writer;

            _overallResult = result.GetAttribute("result");
            if (_overallResult == "Skipped")
            {
                _overallResult = "Warning";
            }

            _options = options;

            Summary = ReadResultSummary(result);
        }
 public static TestResults Run(HostedOptions options, Messages.OnMessage[] subscribers)
 {
     if (!init)
     {
         ServiceManager.Services.ClearServices();
         ServiceManager.Services.AddService(new SettingsService());
         ServiceManager.Services.AddService(new DomainManager());
         ServiceManager.Services.AddService(new ProjectService());
         ServiceManager.Services.AddService(new AddinRegistry());
         ServiceManager.Services.AddService(new AddinManager());
         ServiceManager.Services.AddService(new TestAgency());
         ServiceManager.Services.InitializeServices();
         init = true;
     }
     return(new Runner(options).Execute(subscribers));
 }
        public static TestPackage MakeTestPackage(HostedOptions options)
        {
            ProcessModel     processModel     = ProcessModel.Default;
            RuntimeFramework runtimeFramework = (RuntimeFramework)null;
            TestPackage      testPackage;
            DomainUsage      domainUsage;
            NUnitProject     nunitProject = Services.ProjectService.LoadProject(options.InputFiles);

            testPackage      = nunitProject.ActiveConfig.MakeTestPackage();
            processModel     = nunitProject.ProcessModel;
            domainUsage      = nunitProject.DomainUsage;
            runtimeFramework = nunitProject.ActiveConfig.RuntimeFramework;

            if (!string.IsNullOrEmpty(options.WorkDirectory))
            {
                testPackage.BasePath = options.WorkDirectory;
            }

            testPackage.TestName = null;
            testPackage.Settings["ProcessModel"] = processModel;
            testPackage.Settings["DomainUsage"]  = domainUsage;
            if (runtimeFramework != null)
            {
                testPackage.Settings["RuntimeFramework"] = runtimeFramework;
            }
            // if (domainUsage == DomainUsage.None)
            //   CoreExtensions.Host.AddinRegistry = Services.AddinRegistry;
            testPackage.Settings["ShadowCopyFiles"]   = !false;
            testPackage.Settings["UseThreadedRunner"] = !false;
            testPackage.Settings["DefaultTimeout"]    = 0;
            testPackage.Settings["WorkDirectory"]     = options.WorkDirectory;
            testPackage.Settings["StopOnError"]       = false;
            //if (options.apartment != ApartmentState.Unknown)
            //    testPackage.Settings["ApartmentState"] = options.apartment;
            return(testPackage);
        }
 private TestFilter CreateTestFilter(HostedOptions _options)
 {
     var builder = _filterService.GetTestFilterBuilder();
     return builder.GetFilter();
 }
 public Runner(HostedOptions options)
 {
     _options = options;
 }
 public static TestResults Run(HostedOptions options, Messages.OnMessage[] subscribers)
 {
     if (!init)
     {
         ServiceManager.Services.ClearServices();
         ServiceManager.Services.AddService(new SettingsService());
         ServiceManager.Services.AddService(new DomainManager());
         ServiceManager.Services.AddService(new ProjectService());
         ServiceManager.Services.AddService(new AddinRegistry());
         ServiceManager.Services.AddService(new AddinManager());
         ServiceManager.Services.AddService(new TestAgency());
         ServiceManager.Services.InitializeServices();
         init = true;
     }
     return new Runner(options).Execute(subscribers);
 }
        public static TestPackage MakeTestPackage(HostedOptions options)
        {
            ProcessModel processModel = ProcessModel.Default;
            RuntimeFramework runtimeFramework = (RuntimeFramework)null;
            TestPackage testPackage;
            DomainUsage domainUsage;
            NUnitProject nunitProject = Services.ProjectService.LoadProject(options.InputFiles);
            testPackage = nunitProject.ActiveConfig.MakeTestPackage();
            processModel = nunitProject.ProcessModel;
            domainUsage = nunitProject.DomainUsage;
            runtimeFramework = nunitProject.ActiveConfig.RuntimeFramework;

            if (!string.IsNullOrEmpty( options.WorkDirectory ))
                testPackage.BasePath = options.WorkDirectory;
            
            testPackage.TestName = null;
            testPackage.Settings["ProcessModel"] = processModel;
            testPackage.Settings["DomainUsage"] = domainUsage;
            if (runtimeFramework != null)
                testPackage.Settings["RuntimeFramework"] = runtimeFramework;
            // if (domainUsage == DomainUsage.None)
            //   CoreExtensions.Host.AddinRegistry = Services.AddinRegistry;
            testPackage.Settings["ShadowCopyFiles"] = !false;
            testPackage.Settings["UseThreadedRunner"] = !false;
            testPackage.Settings["DefaultTimeout"] = 0;
            testPackage.Settings["WorkDirectory"] = options.WorkDirectory;
            testPackage.Settings["StopOnError"] = false;
            //if (options.apartment != ApartmentState.Unknown)
            //    testPackage.Settings["ApartmentState"] = options.apartment;
            return testPackage;
        }
        private bool CreateTestFilter(HostedOptions options, out TestFilter testFilter)
        {
            testFilter = TestFilter.Empty;
            SimpleNameFilter simpleNameFilter = new SimpleNameFilter();

            if (testFilter is NotFilter)
            {
                ((NotFilter)testFilter).TopLevel = true;
            }
            return true;
        }
        public static TestResults Run(HostedOptions options, Messages.OnMessage[] messageSubscribers)
        {
            using (ITestEngine engine = TestEngineActivator.CreateInstance())
            {
                if (options.WorkDirectory != null)
                    engine.WorkDirectory = options.WorkDirectory;

                return new Runner(engine, options).Execute(messageSubscribers);
            }
        }
        public static TestPackage MakeTestPackage(HostedOptions options)
        {
            TestPackage package = new TestPackage(options.InputFiles);
            package.AddSetting(PackageSettings.RuntimeFramework, "v4.0");

            return package;
        }
        private TestFilter CreateTestFilter(HostedOptions _options)
        {
            var builder = _filterService.GetTestFilterBuilder();

            return(builder.GetFilter());
        }
 public Runner(HostedOptions options)
 {
     _options = options;
 }