コード例 #1
0
        public IEnumerable Run(ITestListener listener, ITestFilter filter)
        {
            TopLevelWorkItem = m_Factory.Create(LoadedTest, filter);
            TopLevelWorkItem.InitializeContext(Context);
            UnityTestExecutionContext.CurrentContext = Context;
            Context.Listener = listener;

            return(TopLevelWorkItem.Execute());
        }
コード例 #2
0
        /// <summary>
        /// Run selected tests asynchronously, notifying the listener interface as it progresses.
        /// </summary>
        /// <param name="listener">Interface to receive EventListener notifications.</param>
        /// <param name="filter">A test filter used to select tests to be run</param>
        /// <remarks>
        /// RunAsync is a template method, calling various abstract and
        /// virtual methods to be overriden by derived classes.
        /// </remarks>
        public void RunAsync(ITestListener listener, ITestFilter filter)
        {
            log.Info("Running tests");
            if (LoadedTest == null)
            {
                throw new InvalidOperationException("The Run method was called but no test has been loaded");
            }

            CreateTestExecutionContext(listener);

            TopLevelWorkItem = WorkItem.CreateWorkItem(LoadedTest, filter);
            TopLevelWorkItem.InitializeContext(Context);
            TopLevelWorkItem.Completed += OnRunCompleted;

            StartRun(listener);
        }
コード例 #3
0
        /// <summary>
        /// Run selected tests asynchronously, notifying the listener interface as it progresses.
        /// </summary>
        /// <param name="listener">Interface to receive EventListener notifications.</param>
        /// <param name="filter">A test filter used to select tests to be run</param>
        /// <remarks>
        /// <para>RunAsync is a template method, calling various abstract and
        /// virtual methods to be overridden by derived classes.</para>
        /// </remarks>
        public void RunAsync(ITestListener listener, ITestFilter filter)
        {
            log.Info("Running tests");
            if (LoadedTest == null)
            {
                throw new InvalidOperationException("Tests must be loaded before running them.");
            }

            _runComplete.Reset();

            CreateTestExecutionContext(listener);

            TopLevelWorkItem = WorkItemBuilder.CreateWorkItem(LoadedTest, filter, new DebuggerProxy(), true);
            TopLevelWorkItem.InitializeContext(Context);
            TopLevelWorkItem.Completed += OnRunCompleted;

            WrapInNUnitCallContext(() => StartRun(listener));
        }