Example #1
0
        public virtual void FixtureSetup()
        {
#if false
            CheckDisposed();
#else
            /* We need to document cases where this needs to be worried about.
             * I (RandyR) don't understand how this can happen, if the nunit framework
             * creates a test class instance, calls this method, runs all its tests,
             * calls the TestFictureTeardown code (Dispose),
             * and then turns loose of the test class instance.
             *
             * If the above is what happens, then how can it be called twice?
             * If the class can indeed be reused, and this method called more than once,
             * in what contexts does it happen?
             *
             * Until we can nail down that context,
             * let's see if we can live with the more rigid approach.
             *
             * Followup observation:
             * I (RandyR) saw in some acceptance tests (UndoRedoTests) that a test TearDown
             * method had called this method, as well as the Dispose method, as a way
             * to be sure the next was set up correcly. That is not good!
             * I fixed that class to not override this method or the Dispose method,
             * but to just do all the setup/teardown stuff between each test.
             */
            // Answer (TimS/EberhardB): NUnit doesn't create a new instance each time
            // a test fixture is run. Therefore we have to resurrect the instance, otherwise
            // we can't run tests twice in NUnit-GUI.
            // ENHANCE: We think our use of doing a Dispose in the TestFixtureTearDown is wrong,
            // since FixtureSetUp and FixtureTearDown go together, so FixtureTearDown should
            // clean the things that FixtureSetUp created (or that might be left over from
            // running the tests).
            if (m_isDisposed)
            {
                // in case we're running the same test twice we have to reset the m_isDisposed
                // flag, otherwise in FixtureTearDown we think that Dispose was already called.
                m_isDisposed = false;
                GC.ReRegisterForFinalize(this);
            }

#if false
            // This should already be disposed if we run this test fixture twice.
            if (m_DebugProcs != null)
            {
                m_DebugProcs.Dispose();
            }
#endif
#endif

            m_DebugProcs = new DebugProcs();
            try
            {
                StringUtils.InitIcuDataDir();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Example #2
0
        public virtual void FixtureTeardown()
        {
            // FWC-16: we have to call CoFreeUnusedLibraries. This causes sqlnclir.dll to get
            // unloaded. If we don't do this we get a deadlock after the fixture teardown
            // because we're running STA.
            CoFreeUnusedLibraries();

            m_debugProcs.Dispose();
            m_debugProcs = null;
        }
Example #3
0
        /// <summary/>
        public override void AfterTest(TestDetails testDetails)
        {
            m_debugProcs.Dispose();
            CoFreeUnusedLibraries();

            m_currentActivation.Dispose();
            m_activationContext.Dispose();

            base.AfterTest(testDetails);
        }