Exemple #1
0
        /// <summary>
        /// The get new feature.
        /// </summary>
        /// <param name="parent">
        /// The parent.
        /// </param>
        /// <param name="testObject">
        /// The test object.
        /// </param>
        /// <param name="isChecked">
        /// The is Checked.
        /// </param>
        /// <returns>
        /// The <see cref="TestSuiteItem"/>.
        /// </returns>
        private TestSuiteItem AddNewTestSuiteItem(TestSuiteItem parent, TestObject testObject, bool isChecked)
        {
            Log.Enter(this, MethodBase.GetCurrentMethod().Name);

            var testType    = this.GetTestType(testObject);
            var contextMenu = this.GetContextMenu(testObject);
            var description = !string.IsNullOrEmpty(testObject.Description) ? testObject.Description.Replace("\r\n", " ") : string.Empty;

            var childFeature = new TestSuiteItem(testObject.DisplayName, description, false, testType, isChecked, false, testObject, contextMenu, testObject.ToolTip);

            if (parent != null)
            {
                parent.IsExpanded = true;
                parent.Children.Add(childFeature);
            }

            if (testObject is TestCollection)
            {
                var testFolder = testObject as TestCollection;
                foreach (var child in testFolder.TestObjects)
                {
                    this.AddNewTestSuiteItem(childFeature, child, false);
                }
            }

            return(childFeature);
        }
Exemple #2
0
        /// <summary>
        /// The show parameter control.
        /// </summary>
        /// <param name="testMethod">
        /// The test method.
        /// </param>
        /// <param name="selectedFeature">
        /// The selected feature.
        /// </param>
        private void ShowParameterControl(TestMethod testMethod, TestSuiteItem selectedFeature)
        {
            this.editParameterControl.ShowHandlerDialog(testMethod.Parameters);

            selectedFeature.ParameterDescription = this.GetParameterDescription(testMethod);
            selectedFeature.IsValid = this.IsTestObjectValid(testMethod);
        }
Exemple #3
0
        /// <summary>
        /// The copy tree item.
        /// </summary>
        public void CopyTreeItem()
        {
            Log.Enter(this, MethodBase.GetCurrentMethod().Name);

            var testScript = GetSelectedTestSuite(this.TestSuiteModel.TestSuiteList);

            this.testSuiteItemCopy = CopyTestSuite(testScript);
        }
Exemple #4
0
        /// <summary>
        /// The copy feature.
        /// </summary>
        /// <param name="oldTestSuite">
        /// The old Test Suite.
        /// </param>
        /// <returns>
        /// The <see cref="TestSuite"/>.
        /// </returns>
        private static TestSuiteItem CopyTestSuite(TestSuiteItem oldTestSuite)
        {
            var newTestSuite = oldTestSuite.Copy();

            newTestSuite.Parent         = null;
            newTestSuite.HasFocus       = false;
            newTestSuite.IsInFocusChain = false;

            return(newTestSuite);
        }
Exemple #5
0
        /// <summary>
        /// The can move up.
        /// </summary>
        /// <param name="selectedFeature">
        /// The selected feature.
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        private bool CanMoveUp(TestSuiteItem selectedFeature)
        {
            if (selectedFeature != null && selectedFeature.Parent != null)
            {
                var parentFeatureList    = selectedFeature.Parent.Children;
                var selectedFeatureIndex = parentFeatureList.IndexOf(selectedFeature);

                if (selectedFeatureIndex > 0)
                {
                    return(true);
                }
            }

            return(false);
        }
Exemple #6
0
 /// <summary>
 /// The feature move up.
 /// </summary>
 /// <param name="selectedTestSuite">
 /// The selected feature.
 /// </param>
 private void MoveUpTestSuite(TestSuiteItem selectedTestSuite)
 {
     try
     {
         if (this.CanMoveUp(selectedTestSuite))
         {
             var selectedIndex = selectedTestSuite.Parent.Children.IndexOf(selectedTestSuite);
             selectedTestSuite.Parent.Children.Move(selectedIndex, selectedIndex - 1);
         }
     }
     catch (Exception ex)
     {
         Log.ErrorEx(this, ex, ex.Message);
     }
 }