コード例 #1
0
        TestResult ITestItem.Terminate()
        {
            //Enter
            OnEnter(TestMethod.Terminate);
            TestResult result = TestResult.Passed;

            try
            {
                //Skipped
                if (this.Skipped || !this.Implemented)
                {
                    result = TestResult.Skipped;
                }
                else
                {
                    this.Terminate();
                }

                //Before exiting make sure we reset our CurChild to null, to prevent incorrect uses
                if (Parent != null)
                {
                    Parent.CurrentChild = null;
                }
            }
            catch (Exception e)
            {
                HandleException(e);
            }

            try
            {
                //Clear any previous existing info (in the static class).
                if (ptesttype == TestType.TestModule)
                {
                    //Note: We actually have to clear these "statics" since they are not cleaned up
                    //until the process exits.  Which means that if you run again, in an apartment model
                    //thread it will try to release these when setting them which is not allowed to
                    //call a method on an object created in another apartment
                    TestInput.Dispose();
                    TestLog.Dispose();
                }
            }
            catch (Exception e)
            {
                result = HandleException(e);
            }

            //This is also a good point to hint to the GC to free up any unused memory
            //at the end of each TestCase and the end of each module.
            GC.Collect();
            GC.WaitForPendingFinalizers();

            //Leave
            OnLeave(TestMethod.Terminate);
            return(result);
        }
コード例 #2
0
ファイル: TestLoader.cs プロジェクト: xuzhg/Extensions-1
        public void                      Terminate()
        {
            try
            {
                //Clear any previous existing info (in the static class).

                //Note: We actually have to clear these "statics" since they are not cleaned up
                //until the process exits.  Which means that if you run again, in an apartment model
                //thread it will try to release these when setting them which is not allowed to
                //call a method on an object created in another apartment
                TestInput.Dispose();
                TestLog.Dispose();
            }
            catch (Exception)
            {
//				TestLog.HandleException(e);
            }
        }
コード例 #3
0
ファイル: TestItem.cs プロジェクト: zhonli/odata.net
        TestResult ITestItem.Terminate()
        {
            //Enter
            OnEnter(TestMethod.Terminate);
            TestResult result = TestResult.Passed;

            //NOTE: Since exceptions are a way-of-life in C#, and the fact that they are just
            //caught by the runtime before passed back to LTM, we lose the entire stack and just
            //an unknown error code is returned.

            //To help solve this we will wrap the call in a try catch and actually
            //log the exception to the LTM output window...
            try
            {
                //Skipped
                if (this.Skipped || !this.Implemented)
                {
                    result = TestResult.Skipped;
                }
                else
                {
                    this.Terminate();
                }

                //Before exiting make sure we reset our CurChild to null, to prevent incorrect uses
                if (Parent != null)
                {
                    Parent.CurrentChild = null;
                }
            }
            catch (Exception e)
            {
                HandleException(e);
            }

            try
            {
                //Clear any previous existing info (in the static class).
                if (_testtype == TestType.TestModule)
                {
                    //Note: We actually have to clear these "statics" since they are not cleaned up
                    //until the process exits.  Which means that if you run again, in an apartment model
                    //thread it will try to release these when setting them which is not allowed to
                    //call a method on an object created in another apartment
                    TestInput.Dispose();
                    TestLog.Dispose();
                }
            }
            catch (Exception e)
            {
                result = HandleException(e);
            }

            //This is also a good point to hint to the GC to free up any unused memory
            //at the end of each TestCase and the end of each module.
            GC.Collect();
            GC.WaitForPendingFinalizers();

            //Leave
            OnLeave(TestMethod.Terminate);
            return(result);
        }