/// <summary>
        /// This method finds the fixture for this class, and checks that there are two
        /// tests returned (one from the <see cref="TestSuiteFixture"/> and the other
        /// from <see cref="TestFixture"/>).
        /// </summary>
        private void Explore()
        {
            FixtureExplorer explorer = new FixtureExplorer( this.GetType().Assembly );
            explorer.Filter = FixtureFilters.Type(this.GetType().FullName);

            explorer.Explore();
            int i = 0;
            foreach (object fixture in explorer.FixtureGraph.Fixtures)
                ++i;
            Assert.AreEqual(2, i);
        }
Exemplo n.º 2
0
 public void SetTestAssembly(Assembly testAssembly)
 {
     if (testAssembly == null)
     {
         throw new ArgumentNullException("testAssembly");
     }
     this.testAssembly = testAssembly;
     this.explorer     = new FixtureExplorer(this.testAssembly);
     this.topo         = new TopologicalSortAlgorithm(
         this.Explorer.FixtureGraph.Graph);
 }
Exemplo n.º 3
0
 public virtual void Dispose()
 {
     this.explorer      = null;
     this.fixtureRunner = null;
     if (this.resolver != null)
     {
         this.resolver.Dispose();
         this.resolver = null;
     }
     this.report       = null;
     this.testAssembly = null;
 }
Exemplo n.º 4
0
 public virtual void Dispose()
 {
     this.explorer = null;
     this.fixtureRunner = null;
     if (this.resolver != null)
     {
         this.resolver.Dispose();
         this.resolver = null;
     }
     this.report = null;
     this.testAssembly = null;
 }
 public void SetTestAssembly(Assembly testAssembly)
 {
     if (testAssembly == null)
         throw new ArgumentNullException("testAssembly");
     this.testAssembly = testAssembly;
     this.explorer = new FixtureExplorer(this.testAssembly);
     this.topo = new TopologicalSortAlgorithm(
         this.Explorer.FixtureGraph.Graph);
 }
Exemplo n.º 6
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;
            }
        }
Exemplo n.º 7
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;
            }
        }