/// <summary> /// The get simulation area diagnostic event simulation. /// </summary> /// <returns> /// The <see cref="string"/>. /// </returns> public string GetSimulationAreaDiagnosticEventSimulation() { Text text = new NE107Elements().SimulationComboBox; if (text != null) { text.MoveTo(500); Log.Info(LogInfo.Namespace(MethodBase.GetCurrentMethod()), string.Format("Active diagnostic event simulation is [{0}]", text.TextValue)); return(text.TextValue); } return(null); }
/// <summary> /// The compare ne 107 simulation with tree parameter. /// </summary> /// <param name="tab"> /// The tab index which will be selected. CodeWrights started index at 1, so 1 = Electronics, 2 = Process, 3 = Configuration, 4 = Simulation /// </param> /// <param name="diagnosticEvent"> /// The diagnostic event, must be written as shown on GUI /// </param> /// <param name="expectedCategory"> /// The expected category: Failure, Function Check, Out Of Specification or Maintenance Required /// </param> /// <param name="expectedSimulatedEvent"> /// The expected simulated event, must be written as shown on GUI /// </param> /// <param name="pathToParameterInTree"> /// The path to parameter in tree, must be written as shown on GUI /// </param> /// <param name="expectedParameterValue"> /// The expected parameter value, must be written as shown on GUI. Leading letter F, C, S, M could be ignored /// </param> /// <returns> /// The <see cref="bool"/>. /// </returns> // ReSharper disable InconsistentNaming public bool CompareNE107SimulationWithTreeParameter(int tab, string diagnosticEvent, string expectedCategory, string expectedSimulatedEvent, string pathToParameterInTree, string expectedParameterValue) // ReSharper restore InconsistentNaming { if (this.SelectTab(tab)) { string currentCategory = new NE107Functions().GetActiveDiagnosticEventCategory(diagnosticEvent); if (this.RemoveWhiteSpaces(currentCategory).ToLower().Contains(this.RemoveWhiteSpaces(expectedCategory).ToLower())) { string eventLabel = new NE107Elements().EventLabel(diagnosticEvent).GetAttributeValueText("Text"); if (this.SelectTab(4)) { string currentSimulatedEvent = new NE107Functions().GetSimulationAreaDiagnosticEventSimulation(); if (this.RemoveWhiteSpaces(currentSimulatedEvent).ToLower().Contains(this.RemoveWhiteSpaces(expectedSimulatedEvent).ToLower())) { string[] currentEventParts = this.NormalizeWhiteSpaces(currentSimulatedEvent).Split(' '); string[] expectedEventParts = this.NormalizeWhiteSpaces(eventLabel).Split(' '); string currentEventNumber = currentEventParts[0]; string expectedEventNumber = expectedEventParts[expectedEventParts.Length - 1]; if (currentEventNumber.Equals(expectedEventNumber)) { string parameterValue = new GetParameterValue().Run(pathToParameterInTree); if (this.RemoveWhiteSpaces(parameterValue.ToLower()).Contains(this.RemoveWhiteSpaces(expectedParameterValue.ToLower()))) { Report.Info(LogInfo.Namespace(MethodBase.GetCurrentMethod()), string.Format("Diagnostic Event with [{0}] has expected category [{1}]. \nParameter value of parameter [{2}] is as expected [{3}]", diagnosticEvent, expectedCategory, pathToParameterInTree, expectedParameterValue)); return(true); } Report.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), string.Format("Parameter value of parameter [{0}] is not as expected [{1}].", pathToParameterInTree, parameterValue)); return(false); } Report.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), string.Format("Diagnostic event number [{0}] is not as expected [{1}]", currentEventNumber, expectedEventNumber)); return(false); } Report.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), string.Format("Simulated diagnostic event [{0}] is not as expected [{1}]", currentSimulatedEvent, expectedSimulatedEvent)); return(false); } Report.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), string.Format("Error while switching to expceted tab [{0}]", tab)); return(false); } Report.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), string.Format("Diagnostic event category [{0}] is not as expected [{1}]", currentCategory, expectedCategory)); return(false); } Report.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), string.Format("Error while switching to expceted tab [{0}]", tab)); return(false); }
/// <summary> /// Checks whether the NE107 Module is available or not using the tab control element /// </summary> /// <returns> /// true: if the module is available /// false: if module is not available /// </returns> public bool IsNE107ModuleAvailable() { bool result = true; Element tabcontrol = new NE107Elements().TabControlNE107; if (tabcontrol == null) { result = false; Log.Info(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "The Tabcontrol is not found. NE107 Module is not available"); } else { Log.Info(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "The Tabcontrol is found. NE107 Module is available"); } return result; }
/// <summary> /// The select simulation diagnostic event. /// </summary> /// <param name="value"> /// Simulation event which will be selected /// </param> /// <returns> /// True: if call successful, false: if an error occurred /// </returns> public bool SetSimulationAreaDiagnosticEventSimulation(string value) { bool result; Element element = new NE107Elements().ArrayListSimulationDiagnosticEvents; if (element == null) { result = false; Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Combobox Simulation Diagnostic Event is null"); } else { result = this.SetComboBoxValue(element, value); Log.Info(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Selected simulation diagnostic event: " + value); } return result; }
/// <summary> /// The set diagnostic event category. Use this form diagnosticEvent//diagnosticCategory /// </summary> /// <param name="pathToDiagnosticEventRadioButton"> /// The path to diagnostic event radio button. /// <para>diagnosticEvent: could be any of the events listed on selected tab; must be written as displayed</para> /// <para>diagnosticCategory: Failure or Function check or Out of specification or Maintenance required or No effect</para> /// </param> /// <returns> /// The <see cref="bool"/>. /// </returns> public bool SetActiveDiagnosticEventCategory(string pathToDiagnosticEventRadioButton) { Ranorex.RadioButton radioButton = new NE107Elements().EventRadioButton(pathToDiagnosticEventRadioButton); if (radioButton != null) { radioButton.MoveTo(500); if (!radioButton.Checked) { radioButton.Click(); this.ClickApplyButton(); } return(true); } return(false); }
/// <summary> /// Clicks cancel button. /// </summary> /// <returns> /// True: if button was clicked /// False: if an error occurred /// </returns> public bool ClickCancelButton() { bool result = true; Element button = new NE107Elements().CancelButton; if (button == null || button.Enabled == false) { result = false; Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "The cancel button is null or not enabled"); } else { Mouse.MoveTo(button, 500); Mouse.Click(button); Log.Info(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Clicked on Cancel"); } return result; }