private void AddParamater(string name, object value) { TestParameter parameter = new TestParameter(); parameter.Name = name; parameter.Value = String.Format("{0}", value); AddItem(parameter); }
/// <see cref="Opc.Ua.Client.Controls.BaseListCtrl.UpdateItem(ListViewItem,object)" /> protected override void UpdateItem(ListViewItem listItem, object item) { TestParameter parameter = item as TestParameter; if (parameter == null) { base.UpdateItem(listItem, item); return; } listItem.SubItems[0].Text = String.Format("{0}", parameter.Name); listItem.SubItems[1].Text = String.Format("{0}", parameter.Value); listItem.ImageKey = "SimpleItem"; listItem.Tag = item; }
/// <summary> /// Obtains the int value of the specified parameter /// </summary> /// <param name="parameterName">Name of the parameter.</param> /// <param name="testParameter">An array of the test parameters configured in the file.</param> /// <returns></returns> public static int GetTestParameterIntValue(string parameterName, TestParameter[] testParameter) { if (parameterName == null) { throw new ArgumentException(); } if (testParameter == null || testParameter.Length == 0) { return 0; } for (int i = 0; i < testParameter.Length; i++) { if (testParameter[i].Name == parameterName) { return Int32.Parse(testParameter[i].Value); } } return 0; }
/// <summary> /// This method gets the Server details from the test files. /// The $ separated server names and urls are written in the test case file. /// This method extract those values from the file and populates list of the type ServerDetail. /// </summary> /// <param name="testParameter">An array of the test parameters configured in the file.</param> /// <returns>List containing server details.</returns> private static List<ServerDetail> GetTestParameterServerDetails(TestParameter[] testParameter) { List<ServerDetail> ServerDetails = null; bool firstServerDetail = false; if (testParameter == null || testParameter.Length == 0) { return null; } char[] separator = { '$' }; for (int i = 0; i < testParameter.Length; i++) { if (testParameter[i].Name == TestCases.ServerDetails) { if (!firstServerDetail) { ServerDetails = new List<ServerDetail>(); firstServerDetail = true; } string[] details = testParameter[i].Value.Split(separator); if (details.Length != 2) { return null; } ServerDetails.Add(new ServerDetail(details[0], details[1])); } } return ServerDetails; }