This is a generic Test "Shell" that allows you to easily add new test functions and organize them without much effort. The Tests are divided into two basic categories, those that are organized by class hierarchy (e.g., this test applies to all objects at this level of the class hierarchy), and Categorized tests (e.g., this test falls into the Category of "Data Extraction"). The test funcs are collected and sorted into buckets that are then displayed in the correct location in the tree.
Inheritance: System.Windows.Forms.Form
Exemple #1
0
        public Result Execute(ExternalCommandData cmdData, ref string msg, ElementSet elems)
        {
            m_app = cmdData.Application;

            Snoop.CollectorExts.CollectorExt.m_app       = cmdData.Application;
            Snoop.CollectorExts.CollectorExt.m_activeDoc = cmdData.Application.ActiveUIDocument.Document; // TBD: see note in CollectorExt.cs
            Result result;

            try
            {
                // Since we dont have an "App" as such, there is no
                // app-wide data - so just create tests for the duration
                // of the cmd and then destroy them
                CreateAndAddTests();

                Test.TestForm form = new Test.TestForm(RevitLookupTestFuncs.RegisteredTestFuncs());
                if (form.ShowDialog() == DialogResult.OK)
                {
                    form.DoTest();
                }

                result = Result.Succeeded;
            }
            catch (System.Exception e)
            { // we want to catch it so we can see the problem, otherwise it just silently bails out
              /*System.Exception innerException = e.InnerException;
               *
               * while (innerException != null) {
               *  innerException = innerException.InnerException;
               * }
               *
               * msg = innerException.Message;*/
                msg = e.Message;
                MessageBox.Show(msg);


                result = Result.Failed;
            }

            finally
            {
                // if an exception happens anywhere, clean up before quitting
                RemoveAndFreeTestFuncs();
            }

            return(result);
        }
Exemple #2
0
        public Result Execute( ExternalCommandData cmdData, ref string msg, ElementSet elems )
        {
            m_app = cmdData.Application;

              Snoop.CollectorExts.CollectorExt.m_app = cmdData.Application;
              Snoop.CollectorExts.CollectorExt.m_activeDoc = cmdData.Application.ActiveUIDocument.Document;	// TBD: see note in CollectorExt.cs
              Result result;

              try
              {
            // Since we dont have an "App" as such, there is no
            // app-wide data - so just create tests for the duration
            // of the cmd and then destroy them
            CreateAndAddTests();

            Test.TestForm form = new Test.TestForm( RevitLookupTestFuncs.RegisteredTestFuncs() );
            if( form.ShowDialog() == DialogResult.OK )
              form.DoTest();

            result = Result.Succeeded;
              }
              catch( System.Exception e )
              {	// we want to catch it so we can see the problem, otherwise it just silently bails out

            /*System.Exception innerException = e.InnerException;

            while (innerException != null) {
            innerException = innerException.InnerException;
            }

            msg = innerException.Message;*/
            msg = e.Message;
            MessageBox.Show( msg );

            result = Result.Failed;
              }

              finally
              {
            // if an exception happens anywhere, clean up before quitting
            RemoveAndFreeTestFuncs();
              }

              return result;
        }