private void testCase2_Runnable() { _dut1.StartStateMonitor(); _dut2.StartStateMonitor(); _dut1.StopStateMonitor(); _dut1.StopStateMonitor(); waitoneEventHandle.Set(); }
private void testCase1_Runnable() { Logger.WriteLog("TC", "============= Test case WA1 start ============="); tcLoopCounter = 0; tcLoopTimes = 200; dutController dialer = _dut1; dutController receiver = _dut2; dialer.StartStateMonitor(); receiver.StartStateMonitor(); Logger.WriteLog("TcInfo", "Loop times = " + tcLoopTimes + ", " + "duration of each call = " + callDuration_inSeconds + " seconds"); Thread.Sleep(3000); while (tcLoopCounter < tcLoopTimes && runFlag) { tcLoopCounter++; getTimeDiffInMilliseconds(true); //Reset start time processTimeout = 10000; #region Dialer calls Receiver dialer.Dial(receiver.PhoneNumber); do { isDialOK = receiver.CurrentPhoneState.Equals(dutController.DutPhoneState.Ringing); isProcessTimeout = getTimeDiffInMilliseconds() > processTimeout; }while (!isDialOK && !isProcessTimeout); if (isDialOK) { Logger.WriteLog("CheckPoint", "Make a call succefully, result = Pass"); } else if (isProcessTimeout) { Logger.WriteLog("CheckPoint", "Make a call unsuccefully, result = Fail"); dialer.EndCall(); receiver.EndCall(); Thread.Sleep(loopDelay); continue; } #endregion Dialer calls Receiver #region Receiver Picks up isPickupOK = receiver.AnswerCall(10000); if (isPickupOK) { Logger.WriteLog("CheckPoint", "Pick up the incoming call successfully, result = Pass"); dialer.CurrentPhoneState = dutController.DutPhoneState.Connected; } else { Logger.WriteLog("CheckPoint", "Fail to pick up the incoming call, result = Fail"); dialer.EndCall(); receiver.EndCall(); Thread.Sleep(loopDelay); continue; } #endregion Receiver Picks up Thread.Sleep(10000); #region Calling state check getTimeDiffInMilliseconds(true); //Reset start time do { isCallDurationCheckOK = dialer.isPhoneConnected && receiver.isPhoneConnected; isProcessTimeout = ((int)getTimeDiffInMilliseconds() > (callDuration_inSeconds * 1000)); Thread.Sleep(1000); } while (isCallDurationCheckOK && !isProcessTimeout); if (isCallDurationCheckOK) { Logger.WriteLog("CheckPoint", "Callint state check OK, calling duration = " + callDuration_inSeconds + "seconds, result = Pass"); } else { Logger.WriteLog("CheckPoint", "Callint state checking is failed, result = Fail"); dialer.EndCall(); receiver.EndCall(); Thread.Sleep(loopDelay); continue; } #endregion Calling state check #region End call processTimeout = 5000; dialer.EndCall(); do { isEndCallOK = !(dialer.isPhoneConnected || receiver.isPhoneConnected); isProcessTimeout = processTimeout > getTimeDiffInMilliseconds(); Thread.Sleep(1000); } while (!isProcessTimeout && !isEndCallOK); if (isEndCallOK) { Logger.WriteLog("CheckPoint", " Hangs up a call succeefully, result = Pass"); } else { Logger.WriteLog("CheckPoint", "Fail to hang up a call , result =Fail"); } #endregion End call Thread.Sleep(10000); } dialer.StopStateMonitor(); receiver.StopStateMonitor(); waitoneEventHandle.Set(); }