public void ShowOutput() { try { global::Common.Test newTest = new global::Common.Test(); var valueNode = ControlsHelper.GetParameterValueFromControlViewList(ControlViewBindingObject); newTest.Service = new Service { MethodName = SelectedMethodName, IsAsync = false, Values = new Values { ValueList = new List <Value> { valueNode } } }; string input; var output = Controller.InvokeFunctionalTest(newTest, 0, CurrentServiceGuid, out input); MethodOutput = output; } catch (Exception ex) { MessageBox.Show("Error occured during execution of the method"); MethodOutput = ex.Message; } }
public void SaveValues() { try { var valueNode = ControlsHelper.GetParameterValueFromControlViewList(ControlViewBindingObject); global::Common.Test newTest = new global::Common.Test(); var testNodes = (from s in Test.TestPackage.Suites from test in s.Tests where test.Service.MethodName == SelectedMethodName && s.Guid == CurrentServiceGuid select test); int maxValueNodes; if (!_isExisting) { valueNode.Guid = Guid.NewGuid().ToString(); if (testNodes.Count() == 1) { testNodes.ToList()[0].Service.Values.ValueList.Add(valueNode); maxValueNodes = testNodes.ToList()[0].Service.Values.ValueList.Count; } else { newTest.Service = new Service { MethodName = SelectedMethodName, IsAsync = false, Values = new Values { ValueList = new List <Value> { valueNode } } }; Test.TestPackage.Suites.Find(s => s.Guid == CurrentServiceGuid).Tests.Add(newTest); maxValueNodes = 1; } } else { valueNode.Guid = testNodes.ToList()[0].Service.Values.ValueList.Find(v => v.Guid == _existingGuid).Guid; _existingIndex = testNodes.ToList()[0].Service.Values.ValueList.IndexOf( testNodes.ToList()[0].Service.Values.ValueList.Find(v => v.Guid == _existingGuid)); if (_existingIndex > -1) { testNodes.ToList()[0].Service.Values.ValueList[_existingIndex] = valueNode; } maxValueNodes = testNodes.ToList()[0].Service.Values.ValueList.Count; } _isExisting = false; _existingIndex = -1; _existingGuid = string.Empty; List <string> values = new List <string>(); for (int i = 0; i < maxValueNodes; i++) { //values.Add(string.Format("Value Set {0}", i + 1)); values.Add(string.Format("Value Set {0}", testNodes.ToList()[0].Service.Values.ValueList[i].Guid)); } ServiceMethodValues = values; MethodSelected(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error in SaveValues Method"); } finally { NotifyOfPropertyChange(() => CanDisplayDeleteValues); } }