/// <summary>
 /// 终止测试引擎
 /// </summary>
 public void Stop()
 {
     commandInfos.Clear();
     testErrorInfo = null;
     InternalStop();
     IsStarted = false;
 }
예제 #2
0
        /// <summary>
        /// 添加测试结果项
        /// </summary>
        /// <param name="assertName"></param>
        /// <param name="errorInfo"></param>
        internal void AddResultItem(string assertName, AssertUnexpectedException errorInfo)
        {
            var resultItem = new TestResultItem(assertName, errorInfo);

            testResult = testResult && resultItem.IsSuccessful;
            resultItems.Add(resultItem);
        }
        private void UnwrappedExecuteCommand(System.Reflection.MethodInfo commandMethodInfo, TestCommand command)
        {
            var context = new TestCommandContext(command);

            try
            {
                commandMethodInfo.Invoke(this, System.Reflection.BindingFlags.InvokeMethod
                                         | System.Reflection.BindingFlags.NonPublic
                                         | System.Reflection.BindingFlags.Instance
                                         , null, new object[] { context }, null);
            }
            catch (System.Reflection.TargetInvocationException invokeEx)
            {
                if (invokeEx.InnerException != null)
                {
                    if (invokeEx.InnerException is AssertUnexpectedException)
                    {
                        testErrorInfo = (AssertUnexpectedException)(invokeEx.InnerException);
                    }
                    else
                    {
                        throw invokeEx.InnerException;
                    }
                }
                else
                {
                    throw invokeEx;
                }
            }
        }
 /// <summary>
 /// 记录测试警告
 /// </summary>
 /// <param name="ex"></param>
 private void RecordTestWarning(AssertUnexpectedException ex)
 {
     testWarnings.Add(ex);
 }