private void ButtonBase_OnClick(object sender, RoutedEventArgs e) { Dictionary <string, TestStepValueData> testStepValueDatas = new Dictionary <string, TestStepValueData>(); TestStepValueData bufferNameTSV = new TestStepValueData(BufferName.Text, BufferValue.Text, TestStepValueData.ActionModes.Input); testStepValueDatas.Add(BufferName.Text, bufferNameTSV); App.AssistantMain.TestDataHandler.CreateTestStepFromSET("SetBuffer", testStepValueDatas); }
public void CreateTestStepFromSET(string setName, Dictionary <string, TestStepValueData> testStepValues) { TestStepFolder testStepFolder = parentObject as TestStepFolder; if (testStepFolder == null) { throw new NullReferenceException("CurrentFolder is not set"); } string query = "->PROJECT->AllOwnedSubItems=>SUBPARTS:XModule[SetWizard ==\"" + setName + "\"]"; TCObject tcObject = testStepFolder.Search(query)[0]; XModule xModule = tcObject as XModule; if (xModule == null) { return; } XTestStep testStep = testStepFolder.CreateXTestStepFromXModule(xModule); foreach (KeyValuePair <string, TestStepValueData> testStepValuePair in testStepValues) { foreach (XModuleAttribute xModuleAttribute in xModule.Attributes) { if (xModuleAttribute.Name != testStepValuePair.Key) { continue; } XTestStepValue testStepValue = testStep.CreateXTestStepValue(xModuleAttribute); TestStepValueData testStepValueData = testStepValuePair.Value; testStepValue.Value = testStepValueData.Value; testStepValue.ActionMode = ConvertActionMode(testStepValueData.ActionMode); } } }