/// <summary> /// Executes the actions on the action list and then /// the verifications on the verification list /// </summary> /// <returns>True if ALL the verifications pass</returns> public override bool Test() { if (Actions.Count == 0) { string message = "Action list cannot be empty"; Wxs.Instance.Log.Error("Error on wxTsConditional " + Name + " -> " + message); throw new ArgumentNullException(message); } if (condition == null) { string message = "Condition cannot be empty"; Wxs.Instance.Log.Error("Error on wxTsConditional " + Name + " -> " + message); throw new ArgumentNullException(message); } bool result = true; try { if (condition.Verify()) { Wxs.Instance.Log.InfoFormat("Condition [{0}] found!", condition.Name); foreach (wxAction action in Actions) { action.Do(Wxs.Instance.Ie); } } // Execute the common actions if (commonActions.Count > 0) { foreach (wxAction altAction in commonActions) { altAction.Do(Wxs.Instance.Ie); } } foreach (wxVerifier v in Verifications) { if (!v.Verify()) { result = false; } } } catch (Exception e) { Wxs.Instance.Log.Error(e.Message, e); //throw (e); } return(result); }
/// <summary> /// Executes action(s) until condition is true, /// then executes verifications /// </summary> /// <returns>True if ALL the verifications pass</returns> public override bool Test() { if (Actions.Count == 0) { string message = "Action list cannot be empty"; Wxs.Instance.Log.Error("Error on wxTsConditional " + Name + " -> " + message); throw new ArgumentNullException(message); } if (condition == null) { string message = "Condition cannot be empty"; Wxs.Instance.Log.Error("Error on wxTsConditional " + Name + " -> " + message); throw new ArgumentNullException(message); } bool result = true; try { while (!condition.Verify()) { foreach (wxAction action in Actions) { action.Do(Wxs.Instance.Ie); } System.Threading.Thread.Sleep(DelayInMs); } // Execute the common actions foreach (wxVerifier v in Verifications) { if (!v.Verify()) { result = false; } } } catch (Exception e) { Wxs.Instance.Log.Error(e.Message, e); throw (e); } return(result); }