Beispiel #1
0
        /// <summary>
        /// The run.
        /// </summary>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public bool Run()
        {
            bool    result       = true;
            Element changeButton = new GUI.ApplicationArea.MainView.ChangeDeviceAddressMainViewElements().ChangeButton;

            if (changeButton == null)
            {
                EH.PCPS.TestAutomation.Common.Tools.Log.Error(
                    LogInfo.Namespace(MethodBase.GetCurrentMethod()),
                    "Change button is null, check the Ranorex path in the repository");
                result = false;
            }
            else
            {
                if (changeButton.Enabled == false)
                {
                    EH.PCPS.TestAutomation.Common.Tools.Log.Error(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Change button is not enabled");
                    result = false;
                }
                else
                {
                    EH.PCPS.TestAutomation.Common.Tools.Log.Info(LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Button found and enabled, clicking...");
                    Mouse.Click(changeButton);
                }
            }

            return(result);
        }
Beispiel #2
0
        /// <summary>
        /// The run.
        /// </summary>
        /// <param name="deviceTag">
        /// The device tag.
        /// </param>
        /// <param name="deviceAddress">
        /// The device address.
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public bool Run(string deviceTag, string deviceAddress)
        {
            bool result = true;

            if (
                CommunicationLoader.HART.NXA820.ChangeDeviceAddress.Functions.ApplicationArea.MainView.Execution
                .SelectDevice.Run(deviceTag) == false)
            {
                EH.PCPS.TestAutomation.Common.Tools.Log.Error(
                    LogInfo.Namespace(MethodBase.GetCurrentMethod()),
                    "Selecting a device via tag failed, wrong tag used?");
                result = false;
            }
            else
            {
                Element comboBox =
                    new GUI.ApplicationArea.MainView.ChangeDeviceAddressMainViewElements().ChangeDeviceAddressComboBox;
                if (comboBox == null)
                {
                    EH.PCPS.TestAutomation.Common.Tools.Log.Error(
                        LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Change Device Address ComboBox is null");
                    result = false;
                }
                else
                {
                    if (
                        CommunicationLoader.HART.NXA820.ChangeDeviceAddress.Functions.ApplicationArea.MainView.Execution
                        .SetParameter.SetParameterValue(comboBox, deviceAddress) == false)
                    {
                        EH.PCPS.TestAutomation.Common.Tools.Log.Error(
                            LogInfo.Namespace(MethodBase.GetCurrentMethod()),
                            "Changing device address to " + deviceAddress + " failed");
                        result = false;
                    }
                    else
                    {
                        if (
                            CommunicationLoader.HART.NXA820.ChangeDeviceAddress.Functions.ApplicationArea.MainView
                            .Execution.Change.Run() == false)
                        {
                            EH.PCPS.TestAutomation.Common.Tools.Log.Error(
                                LogInfo.Namespace(MethodBase.GetCurrentMethod()), "Clicking the change button failed");
                            result = false;
                        }
                    }
                }
            }

            return(result);
        }