예제 #1
0
        /// <summary>
        /// Calculates the nodes that should be visible in the main window tree view when the specified xen object is hidden.
        /// </summary>
        /// <param name="hiddenObject">The hidden object.</param>
        private ComparableList <IXenObject> CalculatePopulateWithHiddenObject(IXenObject hiddenObject)
        {
            VirtualTreeNode rootNode = MW(() => new MainWindowTreeBuilder(new FlickerFreeTreeView()).CreateNewRootNode(new NavigationPane().Search, NavigationPane.NavigationMode.Infrastructure));

            List <VirtualTreeNode> nodes = new List <VirtualTreeNode>(rootNode.Descendants);

            nodes.RemoveAll(n => hiddenObject.Equals(n.Tag));
            nodes.RemoveAll(n => new List <VirtualTreeNode>(n.Ancestors).Find(nn => hiddenObject.Equals(nn.Tag)) != null);
            return(new ComparableList <IXenObject>(nodes.ConvertAll(n => (IXenObject)n.Tag)));
        }
예제 #2
0
        /// <summary>
        /// Calculates the nodes that should be visible in the main window tree view when the specified xen object is hidden.
        /// </summary>
        /// <param name="hiddenObject">The hidden object.</param>
        private ComparableList<IXenObject> CalculatePopulateWithHiddenObject(IXenObject hiddenObject)
        {
            VirtualTreeNode rootNode = MW(() => new MainWindowTreeBuilder(new FlickerFreeTreeView()).CreateNewRootNode(new NavigationPane().Search, NavigationPane.NavigationMode.Infrastructure));

            List<VirtualTreeNode> nodes = new List<VirtualTreeNode>(rootNode.Descendants);

            nodes.RemoveAll(n => hiddenObject.Equals(n.Tag));
            nodes.RemoveAll(n => new List<VirtualTreeNode>(n.Ancestors).Find(nn => hiddenObject.Equals(nn.Tag)) != null);
            return new ComparableList<IXenObject>(nodes.ConvertAll(n => (IXenObject)n.Tag));
        }
예제 #3
0
        public void TestObjectEquals([ValueSource("AllXenObjectTypesExceptFolder")] Type xenObjectType)
        {
            IXenObject a = (IXenObject)Activator.CreateInstance(xenObjectType);

            SetRandomStuffToFields(a);
            a.opaque_ref = "hello";

            IXenObject b = (IXenObject)Activator.CreateInstance(xenObjectType);

            SetRandomStuffToFields(b);
            b.opaque_ref = "hello";

            IXenObject c = (IXenObject)Activator.CreateInstance(xenObjectType);

            SetRandomStuffToFields(c);
            c.opaque_ref = "goodbye";

            Assert.IsTrue(a.Equals(b), xenObjectType.Name + " Equals failed");
            Assert.IsFalse(a.Equals(c), xenObjectType.Name + " Equals failed");
        }