コード例 #1
0
        private void InvokeEvent(object state)
        {
            EventParam eventParams = (EventParam)state;
            string     eventName   = eventParams.EventName;
            int        sessionId   = eventParams.Session;

            object[] eventParam = eventParams.EventParams;
            switch (eventName)
            {
            case Constants.TestGenerationStart:
                OnTestGenerationStart(ModuleUtils.GetParamValue <ITestGenerationInfo>(eventParam, 0));
                break;

            case Constants.TestGenerationEnd:
                OnTestGenerationEnd(ModuleUtils.GetParamValue <ITestGenerationInfo>(eventParam, 0));
                break;

            case Constants.SessionGenerationStart:
                OnSessionGenerationStart(ModuleUtils.GetParamValue <ISessionGenerationInfo>(eventParam, 0));
                break;

            case Constants.SessionGenerationReport:
                OnSessionGenerationReport(ModuleUtils.GetParamValue <ISessionGenerationInfo>(eventParam, 0));
                break;

            case Constants.SessionGenerationEnd:
                OnSessionGenerationEnd(ModuleUtils.GetParamValue <ISessionGenerationInfo>(eventParam, 0));
                break;

            case Constants.TestProjectStart:
                OnTestProjectStart(ModuleUtils.GetParamValue <List <ITestResultCollection> >(eventParam, 0));
                break;

            case Constants.SessionStart:
                OnTestStart(ModuleUtils.GetParamValue <ITestResultCollection>(eventParam, 0));
                break;

            case Constants.SequenceStarted:
                OnSequenceStarted(ModuleUtils.GetParamValue <ISequenceTestResult>(eventParam, 0));
                break;

            case Constants.StatusReceived:
                OnStatusReceived(ModuleUtils.GetParamValue <IRuntimeStatusInfo>(eventParam, 0));
                break;

            case Constants.SequenceOver:
                OnSequenceOver(ModuleUtils.GetParamValue <ISequenceTestResult>(eventParam, 0));
                break;

            case Constants.SessionOver:
//                    eventHandle.OnTestOver(ModuleUtil.GetParamValue<ITestResultCollection>(eventParams, 0),
//                        ModuleUtil.GetParamValue<ISequenceGroup>(eventParams, 1));
                OnTestOver(ModuleUtils.GetParamValue <ITestResultCollection>(eventParam, 0));
                break;

            case Constants.TestProjectOver:
                OnTestProjectOver(ModuleUtils.GetParamValue <List <ITestResultCollection> >(eventParam, 0));
                break;

            case Constants.BreakPointHitted:
                OnBreakPointHitted(ModuleUtils.GetParamValue <IDebuggerHandle>(eventParam, 0),
                                   ModuleUtils.GetParamValue <IDebugInformation>(eventParam, 1));
                break;

            default:
                I18N i18N = I18N.GetInstance(Constants.I18nName);
                throw new TestflowInternalException(ModuleErrorCode.UnexistEvent,
                                                    i18N.GetFStr("UnexistEvent", eventName));
                break;
            }
        }