Example #1
0
        public virtual void Run(
            FixtureExplorer explorer,
            ReportListener reportListener
            )
        {
            if (explorer == null)
                throw new ArgumentNullException("explorer");
            if (reportListener == null)
				throw new ArgumentNullException("reportListener");

            this.explorer = explorer;
            this.report = reportListener;
            this.abortPending = false;

            try
            {
                // start reporting
                this.Report.StartTests();

                if (this.IsAbortPending)
                    return;

                // assembly setup
                if (!this.RunAssemblySetUp())
                    return;

                if (this.IsAbortPending)
                    return;

                try
                {
                    RunFixtures();
                }
                finally
                {
                    this.RunAssemblyTearDown();
                }
            }
            catch (Exception ex)
            {
                ReportException rex = ReportException.FromException(ex);
                ReportExceptionException rexe = new ReportExceptionException(
                    "Internal error while running tests in " + 
                    this.Explorer.AssemblyName, rex);
                throw rexe;
            }
            finally
            {
                this.Report.FinishTests();

                this.explorer = null;
                this.report = null;
            }
        }
 public virtual void Populate()
 {
     try
     {
         this.explorer.Explore();
         this.LoadPipes();
     }
     catch (Exception ex)
     {
         ReportException rex = ReportException.FromException(ex);
         ReportExceptionException rexe = new ReportExceptionException(
             String.Format("Error while loading tests in {0}: {1}",
                 this.testAssembly.FullName,
                 ex.Message
                     ),
             rex);
         throw rexe;
     }
 }
        public void PopulateFacade(TestTreeNodeFacade rfacade)
        {
            try
            {
                if (rfacade==null)
                    throw new ArgumentNullException("rfacade");
                if (this.facade != null)
                {
                    this.facade.Changed -= new ResultEventHandler(rfacade.Changed);
                }

                this.facade=new RemotedTestTreeNodeFacade();
                this.facade.Changed += new ResultEventHandler(rfacade.Changed);
                foreach (Fixture fixture in this.Explorer.FixtureGraph.Fixtures)
                {
                    foreach (RunPipeStarter starter in fixture.Starters)
                    {
                        starter.Listeners.Add(this.facade);
                        rfacade.AddPipe(starter.Pipe.Identifier);
                    }
                }
            }
            catch (Exception ex)
            {
                ReportException rex = ReportException.FromException(ex);
                ReportExceptionException rexe = new ReportExceptionException(
                    "Error while populating facade of " + this.TestAssembly.FullName,
                    rex);
                throw rexe;
            }
        }