Beispiel #1
0
 /// <summary>
 /// The deselect children.
 /// </summary>
 /// <param name="testScriptItem">
 /// The test script item.
 /// </param>
 public void DeselectChildren(TestScriptItem testScriptItem)
 {
     foreach (var child in testScriptItem.Children)
     {
         this.DeselectChildren(child);
     }
 }
Beispiel #2
0
        /// <summary>
        /// The copy.
        /// </summary>
        /// <returns>
        /// The <see cref="TestScriptItem"/>.
        /// </returns>
        public TestScriptItem Copy()
        {
            var testScriptCopy = new TestScriptItem(this.Name, this.ParameterDescription, this.Description, this.IsGroup, this.TestType, this.IsChecked, this.IsEditMode, CopyTestObject(this.Tag as TestObject), this.ContextMenuItems, this.IsValid, this.ToolTip);

            if (this.Children != null)
            {
                testScriptCopy.Children.Copy(this.Children);
            }

            return(testScriptCopy);
        }
Beispiel #3
0
        /// <summary>
        /// The deselect parent.
        /// </summary>
        /// <param name="testScriptItem">
        /// The test script item.
        /// </param>
        public void DeselectParent(TestScriptItem testScriptItem)
        {
            if (testScriptItem.HasFocus)
            {
                testScriptItem.HasFocus = false;
            }

            if (testScriptItem.Parent != null)
            {
                this.DeselectParent(testScriptItem.Parent);
            }
        }
Beispiel #4
0
        /// <summary>
        /// Initializes a new instance of the TestScriptTreeNode class.
        /// </summary>
        /// <param name="tree">
        /// The tree.
        /// </param>
        /// <param name="tag">
        /// The tag.
        /// </param>
        public TestScriptTreeNode(TreeListView tree, TestScriptItem tag)
        {
            if (tree == null)
            {
                throw new ArgumentNullException("tree");
            }

            tag.PropertyChanged += this.TestScriptPropertyChanged;

            this.tree     = tree;
            this.children = new TreeNodeCollection(this);
            this.nodes    = new ReadOnlyCollection <TreeNode>(this.children);
            this.tag      = tag;
        }
Beispiel #5
0
        /// <summary>
        /// Determines whether [has children with modified is checked] [the specified feature].
        /// </summary>
        /// <param name="testScript">
        /// The feature.
        /// </param>
        /// <returns>
        /// <c>true</c> if [has children with modified is checked] [the specified feature]; otherwise, <c>false</c>.
        /// </returns>
        private bool HasChildrenWithModifiedIsChecked(TestScriptItem testScript)
        {
            bool modified = false;

            foreach (var child in testScript.Children)
            {
                if (child.IsCheckedModified)
                {
                    modified = true;
                    break;
                }
            }

            return(modified);
        }
Beispiel #6
0
        /// <summary>
        /// Determines whether [has children with different is checked] [the specified feature].
        /// </summary>
        /// <param name="testScript">
        /// The feature.
        /// </param>
        /// <param name="isChecked">
        /// if set to <c>true</c> [is checked].
        /// </param>
        /// <returns>
        /// <c>true</c> if [has children with different is checked] [the specified feature]; otherwise, <c>false</c>.
        /// </returns>
        private bool HasChildrenWithDifferentIsChecked(TestScriptItem testScript, bool?isChecked)
        {
            bool different = false;

            foreach (var child in testScript.Children)
            {
                if (child.IsChecked != isChecked)
                {
                    different = true;
                    break;
                }
            }

            return(different);
        }
Beispiel #7
0
        /// <summary>
        /// Determines whether [has children with different action] [the specified feature].
        /// </summary>
        /// <param name="testScript">
        /// The feature.
        /// </param>
        /// <param name="action">
        /// The action.
        /// </param>
        /// <returns>
        /// <c>true</c> if [has children with different action] [the specified feature]; otherwise, <c>false</c>.
        /// </returns>
        private bool HasChildrenWithDifferentAction(TestScriptItem testScript, TestType action)
        {
            bool different = false;

            foreach (var child in testScript.Children)
            {
                if (child.TestType != action)
                {
                    different = true;
                    break;
                }
            }

            return(different);
        }
Beispiel #8
0
        /// <summary>
        /// The remove test object.
        /// </summary>
        /// <param name="oldTestScript">
        /// The old test script.
        /// </param>
        private static void RemoveTestObject(TestScriptItem oldTestScript)
        {
            oldTestScript.IsValid = true;

            var oldTestObject = oldTestScript.Tag as TestObject;

            if (oldTestObject != null)
            {
                if (oldTestObject.Parent is TestCollection)
                {
                    var oldTestFolderParent = oldTestObject.Parent as TestCollection;
                    oldTestFolderParent.TestObjects.Remove(oldTestObject);
                }
            }
        }
Beispiel #9
0
 /// <summary>
 /// The propagate focus down.
 /// </summary>
 /// <param name="changedTestScript">
 /// The changed test script.
 /// </param>
 /// <param name="hasFocus">
 /// The has focus.
 /// </param>
 public void PropagateFocusDown(TestScriptItem changedTestScript, bool hasFocus)
 {
     if (this.Children != null)
     {
         foreach (var child in this.Children)
         {
             if (changedTestScript == null || ((changedTestScript.Tag as TestObject).Guid != (child.Tag as TestObject).Guid))
             {
                 child.IsPropagated = true;
                 child.HasFocus     = hasFocus;
                 child.IsPropagated = false;
                 child.PropagateFocusDown(changedTestScript, hasFocus);
             }
         }
     }
 }
Beispiel #10
0
        /// <summary>
        /// The add test object.
        /// </summary>
        /// <param name="newTestScript">
        /// The new test script.
        /// </param>
        private static void AddTestObjectToParentTestObjects(TestScriptItem newTestScript)
        {
            var parentTestScriptTag = newTestScript.Parent.Tag;

            if (parentTestScriptTag is TestCollection)
            {
                var newTestObject    = newTestScript.Tag as TestObject;
                var parentTestFolder = parentTestScriptTag as TestCollection;

                var vorhanden = parentTestFolder.TestObjects.Any(testMethods => newTestObject != null && testMethods.Guid == newTestObject.Guid);

                if (!vorhanden)
                {
                    parentTestFolder.TestObjects.Add(newTestObject);
                }
            }
        }
Beispiel #11
0
        /// <summary>
        /// The propagate focus up.
        /// </summary>
        /// <param name="changedTestScript">
        /// The changed test script.
        /// </param>
        /// <param name="hasFocus">
        /// The has focus.
        /// </param>
        public void PropagateFocusUp(TestScriptItem changedTestScript, bool hasFocus)
        {
            var parentTestScript = this.Parent;

            if (parentTestScript != null)
            {
                if (parentTestScript.Children != null)
                {
                    parentTestScript.IsPropagated = true;
                    parentTestScript.HasFocus     = hasFocus;
                    parentTestScript.IsPropagated = false;
                    parentTestScript.PropagateFocusUp(changedTestScript, hasFocus);
                }
            }
            else
            {
                this.PropagateFocusDown(changedTestScript, hasFocus);
            }
        }
Beispiel #12
0
 /// <summary>
 /// The has children with focus.
 /// </summary>
 /// <param name="parentTestScript">
 /// The parent test script.
 /// </param>
 /// <param name="hasFocus">
 /// The has focus.
 /// </param>
 /// <returns>
 /// The <see cref="bool"/>.
 /// </returns>
 /// <exception cref="NotImplementedException">
 /// </exception>
 private bool HasChildrenWithFocus(TestScriptItem parentTestScript, bool?hasFocus)
 {
     throw new NotImplementedException();
 }
Beispiel #13
0
 /// <summary>
 /// The has children with different valid.
 /// </summary>
 /// <param name="parentTestScript">
 /// The parent feature.
 /// </param>
 /// <param name="isValid">
 /// The is valid.
 /// </param>
 /// <returns>
 /// The <see cref="bool"/>.
 /// </returns>
 private bool HasChildrenWithDifferentValid(TestScriptItem parentTestScript, bool?isValid)
 {
     return(parentTestScript.Children.Any(child => child.IsValid != isValid));
 }