Пример #1
0
        /// <summary>
        /// Populates the node using the <see cref="RunPipe"/> instance
        /// contained in <paramref name="pipes"/>.
        /// </summary>
        public override void Populate(
            GuidTestTreeNodeDictionary nodes,
            TestTreeNode rootNode, RunPipeStarterCollection pipes)
        {
            if (rootNode == null)
            {
                throw new ArgumentNullException("rootNode");
            }
            if (pipes == null)
            {
                throw new ArgumentNullException("pipes");
            }

            if (this.parentNode == null)
            {
                this.parentNode = new TestTreeNode("Namespaces", TestNodeType.Populator);
                rootNode.Nodes.Add(this.parentNode);
                nodes.Add(this.parentNode);
            }

            foreach (RunPipeStarter pipeStarter in pipes)
            {
                TestTreeNode namespaceNode = this.addNamespaceNodes(nodes, pipeStarter);

                // get fixture name
                TestTreeNode fixtureNode = this.addFixtureNode(nodes, namespaceNode, pipeStarter);

                CreatePipeNode(nodes, fixtureNode, pipeStarter);
            }
        }
        public override void Populate(
            GuidTestTreeNodeDictionary nodes,
            TestTreeNode root,
            RunPipeStarterCollection pipes)
        {
            if (this.parentNode == null)
            {
                this.parentNode = new TestTreeNode("Categories", TestNodeType.Populator);
                root.Nodes.Add(this.parentNode);
                nodes.Add(this.parentNode);
                this.miscNode = this.addCategoryNodes(nodes, "Misc");
            }

            foreach(RunPipeStarter starter in pipes)
            {
                if (TypeHelper.HasCustomAttribute(
                    starter.Pipe.FixtureType,
                    typeof(FixtureCategoryAttribute)
                    ))
                {
                    foreach(TestTreeNode categoryNode in
                        this.categoryNodesFrom(nodes,starter.Pipe.FixtureType))
                    {
                        TestTreeNode fixtureNode = addFixtureNode(nodes,categoryNode,starter);
                        CreatePipeNode(nodes,fixtureNode,starter);
                    }
                }
                else
                {
                    TestTreeNode fixtureNode = addFixtureNode(nodes,this.miscNode,starter);
                    CreatePipeNode(nodes,fixtureNode,starter);
                }
            }
        }
		/// <summary>
		/// Populates the node using the <see cref="RunPipe"/> instance
		/// contained in <paramref name="pipes"/>.
		/// </summary>
		public override void Populate(
			GuidTestTreeNodeDictionary nodes, 
			TestTreeNode rootNode, RunPipeStarterCollection pipes)
		{
			if (rootNode==null)
				throw new ArgumentNullException("rootNode");
			if (pipes==null)
				throw new ArgumentNullException("pipes");

            if (this.parentNode == null)
            {
                this.parentNode = new TestTreeNode("Namespaces", TestNodeType.Populator);
                rootNode.Nodes.Add(this.parentNode);
                nodes.Add(this.parentNode);
            }

            foreach(RunPipeStarter pipeStarter in pipes)
			{
				TestTreeNode namespaceNode = this.addNamespaceNodes(nodes,pipeStarter);

				// get fixture name
				TestTreeNode fixtureNode = this.addFixtureNode(nodes,namespaceNode,pipeStarter);

				CreatePipeNode(nodes,fixtureNode,pipeStarter);
			}
		}
Пример #4
0
        private TestTreeNode addCategoryNodes(GuidTestTreeNodeDictionary nodes, string category)
        {
            string ns = "";

            TestTreeNode parent = this.parentNode;

            foreach (string name in category.Split('.'))
            {
                if (ns.Length == 0)
                {
                    ns += name;
                }
                else
                {
                    ns += "." + name;
                }

                if (!this.categoryNodes.Contains(ns))
                {
                    TestTreeNode node = new TestTreeNode(name, TestNodeType.Category);

                    nodes.Add(node);
                    this.categoryNodes.Add(ns, node);
                    parent.Nodes.Add(node);
                    parent = node;
                }
                else
                {
                    parent = (TestTreeNode)this.categoryNodes[ns];
                }
            }

            return(parent);
        }
Пример #5
0
        public override void Populate(
            GuidTestTreeNodeDictionary nodes,
            TestTreeNode root,
            RunPipeStarterCollection pipes)
        {
            if (this.parentNode == null)
            {
                this.parentNode = new TestTreeNode("Categories", TestNodeType.Populator);
                root.Nodes.Add(this.parentNode);
                nodes.Add(this.parentNode);
                this.miscNode = this.addCategoryNodes(nodes, "Misc");
            }

            foreach (RunPipeStarter starter in pipes)
            {
                if (TypeHelper.HasCustomAttribute(
                        starter.Pipe.FixtureType,
                        typeof(FixtureCategoryAttribute)
                        ))
                {
                    foreach (TestTreeNode categoryNode in
                             this.categoryNodesFrom(nodes, starter.Pipe.FixtureType))
                    {
                        TestTreeNode fixtureNode = addFixtureNode(nodes, categoryNode, starter);
                        CreatePipeNode(nodes, fixtureNode, starter);
                    }
                }
                else
                {
                    TestTreeNode fixtureNode = addFixtureNode(nodes, this.miscNode, starter);
                    CreatePipeNode(nodes, fixtureNode, starter);
                }
            }
        }
Пример #6
0
        public void Test()
        {
            this.target = new FixtureCategoryTestTreePopulator();
            this.dic    = new GuidTestTreeNodeDictionary();

            root = new TestTreeNode("root", TestNodeType.Category);

            AddPipe(typeof(MbUnit.Core.Remoting.DummyClass1));
            AddPipe(typeof(MbUnit.Core.Remoting.DummyClass2));

            Visit(root, "");

            Assert.AreEqual(1, root.Nodes.Count);

            TestTreeNode categories = root.Nodes[0];

            Assert.AreEqual("Categories", categories.Name);
            Assert.AreEqual(3, categories.Nodes.Count);

            foreach (TestTreeNode node in categories.Nodes)
            {
                Assert.AreEqual(1, node.Nodes.Count);
                switch (node.Name)
                {
                case "Misc":
                {
                    TestTreeNode dummyNode2 = node.Nodes[0];
                    Assert.AreEqual(1, dummyNode2.Nodes.Count);
                    Assert.AreEqual("DummyClass2", dummyNode2.Name);

                    break;
                }

                case "MyApp":
                {
                    TestTreeNode businessLogic = node.Nodes[0];
                    Assert.AreEqual(1, businessLogic.Nodes.Count);
                    Assert.AreEqual("BusinessLogic", businessLogic.Name);

                    TestTreeNode dummyNode1 = businessLogic.Nodes[0];
                    Assert.AreEqual(1, dummyNode1.Nodes.Count);
                    Assert.AreEqual("DummyClass1", dummyNode1.Name);

                    break;
                }

                case "BusinessLogic":
                {
                    TestTreeNode dummyNode1 = node.Nodes[0];
                    Assert.AreEqual(1, dummyNode1.Nodes.Count);
                    Assert.AreEqual("DummyClass1", dummyNode1.Name);

                    break;
                }
                }
            }
        }
        public void Test()
        {
            this.target = new FixtureCategoryTestTreePopulator();
            this.dic = new GuidTestTreeNodeDictionary();

            root = new TestTreeNode("root", TestNodeType.Category);

            AddPipe(typeof(MbUnit.Core.Remoting.DummyClass1));
            AddPipe(typeof(MbUnit.Core.Remoting.DummyClass2));

            Visit(root,"");

            Assert.AreEqual(1, root.Nodes.Count);

            TestTreeNode categories = root.Nodes[0];
            Assert.AreEqual("Categories", categories.Name);
            Assert.AreEqual(3, categories.Nodes.Count);

            foreach (TestTreeNode node in categories.Nodes)
            {
                Assert.AreEqual(1, node.Nodes.Count);
                switch (node.Name)
                {
                    case "Misc":
                        {
                            TestTreeNode dummyNode2 = node.Nodes[0];
                            Assert.AreEqual(1, dummyNode2.Nodes.Count);
                            Assert.AreEqual("DummyClass2", dummyNode2.Name);

                            break;
                        }

                    case "MyApp":
                        {
                            TestTreeNode businessLogic = node.Nodes[0];
                            Assert.AreEqual(1, businessLogic.Nodes.Count);
                            Assert.AreEqual("BusinessLogic", businessLogic.Name);

                            TestTreeNode dummyNode1 = businessLogic.Nodes[0];
                            Assert.AreEqual(1, dummyNode1.Nodes.Count);
                            Assert.AreEqual("DummyClass1", dummyNode1.Name);

                            break;
                        }

                    case "BusinessLogic":
                        {
                            TestTreeNode dummyNode1 = node.Nodes[0];
                            Assert.AreEqual(1, dummyNode1.Nodes.Count);
                            Assert.AreEqual("DummyClass1", dummyNode1.Name);

                            break;
                        }
                }
            }
        }
Пример #8
0
        public override void Dispose()
        {
            base.Dispose();

            this.facade.Clear();
            this.facade = null;
            this.guidNodes = null;
            this.populators = null;
            this.parentNode = null;
        }
Пример #9
0
        public override void Dispose()
        {
            base.Dispose();

            this.facade.Clear();
            this.facade     = null;
            this.guidNodes  = null;
            this.populators = null;
            this.parentNode = null;
        }
Пример #10
0
        private IEnumerable categoryNodesFrom(GuidTestTreeNodeDictionary nodes, Type fixtureType)
        {
            ArrayList catNodes = new ArrayList();

            foreach (FixtureCategoryAttribute cat in
                     fixtureType.GetCustomAttributes(typeof(FixtureCategoryAttribute), true))
            {
                // get parent
                TestTreeNode catNode = this.addCategoryNodes(nodes, cat.Category);
                catNodes.Add(catNode);
            }

            return(catNodes);
        }
Пример #11
0
        public override void Populate(
            GuidTestTreeNodeDictionary nodes,
            TestTreeNode rootNode,
            RunPipeStarterCollection pipes
            )
        {
            if (rootNode == null)
            {
                throw new ArgumentNullException("rootNode");
            }
            if (pipes == null)
            {
                throw new ArgumentNullException("pipes");
            }

            if (this.parentNode == null)
            {
                this.parentNode = new TestTreeNode("Importances", TestNodeType.Populator);
                rootNode.Nodes.Add(this.parentNode);
                nodes.Add(this.parentNode);
                // adding nodes
                foreach (TestImportance ti in Enum.GetValues(typeof(TestImportance)))
                {
                    this.addImportance(nodes, ti);
                }
                // add unknown Importance
                anonymous = this.addImportance(nodes, TestImportance.Default);
            }

            foreach (RunPipeStarter pipeStarter in pipes)
            {
                // get Importance attribute
                TestTreeNode node = null;
                if (TypeHelper.HasCustomAttribute(pipeStarter.Pipe.FixtureType, typeof(ImportanceAttribute)))
                {
                    ImportanceAttribute Importance = (ImportanceAttribute)TypeHelper.GetFirstCustomAttribute(
                        pipeStarter.Pipe.FixtureType, typeof(ImportanceAttribute));

                    node = addImportance(nodes, Importance.Importance);
                }
                else
                {
                    node = anonymous;
                }

                TestTreeNode fixtureNode = addFixtureNode(nodes, node, pipeStarter);
                CreatePipeNode(nodes, fixtureNode, pipeStarter);
            }
        }
Пример #12
0
        private TestTreeNode addImportance(
            GuidTestTreeNodeDictionary nodes,
            TestImportance importance)
        {
            TestTreeNode node = this.importanceNodes[importance.ToString()];

            if (node == null)
            {
                node = new TestTreeNode(importance.ToString(), TestNodeType.Category);
                this.parentNode.Nodes.Add(node);
                this.importanceNodes.Add(importance.ToString(), node);
                nodes.Add(node);
            }
            return(node);
        }
Пример #13
0
        private TestTreeNode addTestsOn(
            GuidTestTreeNodeDictionary nodes,
            string testedTypeFullName)
        {
            TestTreeNode node = this.testedTypeNodes[testedTypeFullName];

            if (node == null)
            {
                node = new TestTreeNode(testedTypeFullName, TestNodeType.Category);
                this.parentNode.Nodes.Add(node);
                nodes.Add(node);
                this.testedTypeNodes.Add(testedTypeFullName, node);
            }
            return(node);
        }
Пример #14
0
        private TestTreeNode addAuthor(
            GuidTestTreeNodeDictionary nodes,
            string name)
        {
            TestTreeNode node = this.authorNodes[name];

            if (node == null)
            {
                node = new TestTreeNode(name, TestNodeType.Category);
                this.parentNode.Nodes.Add(node);
                nodes.Add(node);
                this.authorNodes.Add(name, node);
            }
            return(node);
        }
Пример #15
0
        private TestTreeNode addFixtureNode(GuidTestTreeNodeDictionary nodes,
                                            TestTreeNode parentNode,
                                            RunPipeStarter pipeStarter)
        {
            RunPipe pipe = pipeStarter.Pipe;
            string  key  = pipe.FixtureName + parentNode.FullPath;

            if (!this.fixtureNodes.Contains(key))
            {
                TestTreeNode fixtureNode = new TestTreeNode(pipe.FixtureName, TestNodeType.Fixture);
                this.fixtureNodes.Add(key, fixtureNode);
                nodes.Add(fixtureNode);
                parentNode.Nodes.Add(fixtureNode);
            }
            return((TestTreeNode)this.fixtureNodes[key]);
        }
Пример #16
0
        private TestTreeNode addFixtureNode(
            GuidTestTreeNodeDictionary nodes,
            TestTreeNode parentNode,
            RunPipeStarter pipeStarter)
        {
            RunPipe pipe = pipeStarter.Pipe;

            if (!this.fixtureNodes.Contains(pipe.FixtureName))
            {
                TestTreeNode fixtureNode = new TestTreeNode(pipe.FixtureName, TestNodeType.Fixture);
                this.fixtureNodes.Add(pipe.FixtureName, fixtureNode);
                nodes.Add(fixtureNode);
                parentNode.Nodes.Add(fixtureNode);
            }
            return((TestTreeNode)this.fixtureNodes[pipe.FixtureName]);
        }
Пример #17
0
		private TestTreeNode addFixtureNode(GuidTestTreeNodeDictionary nodes, 
			TestTreeNode parentNode,
			RunPipeStarter pipeStarter)
		{
			RunPipe pipe = pipeStarter.Pipe;
            TestTreeNode fixtureNode = this.fixtureNodes[pipe.Fixture.Type] as TestTreeNode;
            if (fixtureNode != null)
                return fixtureNode;

            fixtureNode = new TestTreeNode(pipe.FixtureName,TestNodeType.Fixture);
			this.fixtureNodes.Add(pipe.Fixture.Type,fixtureNode);
			nodes.Add(fixtureNode);
			parentNode.Nodes.Add(fixtureNode);

            return fixtureNode;
        }
 public static TestTreeNode CreatePipeNode(
     GuidTestTreeNodeDictionary nodes,
     TestTreeNode parentNode, RunPipeStarter starter)
 {
     TestTreeNode pipeNode = new TestTreeNode(starter.Pipe.ShortName,TestNodeType.Test);
     pipeNode.Starter = starter;
     pipeNode.State = TestState.NotRun;
     nodes.Add(pipeNode);
     parentNode.Nodes.Add(pipeNode);
     /*
     foreach (RunInvokerVertex v in starter.Pipe.Invokers)
     {
         TestTreeNode invokerNode = new TestTreeNode(v.Invoker.Name,TestNodeType.Invoker);
         pipeNode.Nodes.Add(invokerNode);
     }
     */
     return pipeNode;
 }
Пример #19
0
        public override void Populate(
            GuidTestTreeNodeDictionary nodes,
            TestTreeNode rootNode,
            MbUnit.Core.Collections.RunPipeStarterCollection pipes
            )
        {
            if (rootNode == null)
            {
                throw new ArgumentNullException("rootNode");
            }
            if (pipes == null)
            {
                throw new ArgumentNullException("pipes");
            }

            if (this.parentNode == null)
            {
                this.parentNode = new TestTreeNode("Authors", TestNodeType.Populator);
                nodes.Add(this.parentNode);
                rootNode.Nodes.Add(this.parentNode);
                // add unknown author
                this.anonymous = this.addAuthor(nodes, "Anonymous");
            }

            foreach (RunPipeStarter pipeStarter in pipes)
            {
                // get author attribute
                TestTreeNode    node   = null;
                AuthorAttribute author = (AuthorAttribute)TypeHelper.TryGetFirstCustomAttribute(
                    pipeStarter.Pipe.FixtureType, typeof(AuthorAttribute));
                if (author != null)
                {
                    node = addAuthor(nodes, author.Name);
                }
                else
                {
                    node = anonymous;
                }

                TestTreeNode fixtureNode = addFixtureNode(nodes, node, pipeStarter);

                CreatePipeNode(nodes, fixtureNode, pipeStarter);
            }
        }
        public override void Populate(
            GuidTestTreeNodeDictionary nodes,
            TestTreeNode rootNode,
            RunPipeStarterCollection pipes
            )
        {
            if (rootNode==null)
                throw new ArgumentNullException("rootNode");
            if (pipes==null)
                throw new ArgumentNullException("pipes");

            if (this.parentNode == null)
            {
                this.parentNode = new TestTreeNode("Importances", TestNodeType.Populator);
                rootNode.Nodes.Add(this.parentNode);
                nodes.Add(this.parentNode);
                // adding nodes
                foreach (TestImportance ti in Enum.GetValues(typeof(TestImportance)))
                {
                    this.addImportance(nodes, ti);
                }
                // add unknown Importance
                anonymous = this.addImportance(nodes, TestImportance.Default);
            }

            foreach(RunPipeStarter pipeStarter in pipes)
            {
                // get Importance attribute
                TestTreeNode node = null;
                if (TypeHelper.HasCustomAttribute(pipeStarter.Pipe.FixtureType,typeof(ImportanceAttribute)))
                {
                    ImportanceAttribute Importance = (ImportanceAttribute)TypeHelper.GetFirstCustomAttribute(
                        pipeStarter.Pipe.FixtureType,typeof(ImportanceAttribute));

                    node = addImportance(nodes,Importance.Importance);
                }
                else
                    node = anonymous;

                TestTreeNode fixtureNode = addFixtureNode(nodes,node,pipeStarter);
                CreatePipeNode(nodes,fixtureNode,pipeStarter);
            }
        }
Пример #21
0
        private TestTreeNode addFixtureNode(GuidTestTreeNodeDictionary nodes,
                                            TestTreeNode parentNode,
                                            RunPipeStarter pipeStarter)
        {
            RunPipe      pipe        = pipeStarter.Pipe;
            TestTreeNode fixtureNode = this.fixtureNodes[pipe.Fixture.Type] as TestTreeNode;

            if (fixtureNode != null)
            {
                return(fixtureNode);
            }

            fixtureNode = new TestTreeNode(pipe.FixtureName, TestNodeType.Fixture);
            this.fixtureNodes.Add(pipe.Fixture.Type, fixtureNode);
            nodes.Add(fixtureNode);
            parentNode.Nodes.Add(fixtureNode);

            return(fixtureNode);
        }
Пример #22
0
        public static TestTreeNode CreatePipeNode(
            GuidTestTreeNodeDictionary nodes,
            TestTreeNode parentNode, RunPipeStarter starter)
        {
            TestTreeNode pipeNode = new TestTreeNode(starter.Pipe.ShortName, TestNodeType.Test);

            pipeNode.Starter = starter;
            pipeNode.State   = TestState.NotRun;
            nodes.Add(pipeNode);
            parentNode.Nodes.Add(pipeNode);

/*
 *                      foreach (RunInvokerVertex v in starter.Pipe.Invokers)
 *                      {
 *                              TestTreeNode invokerNode = new TestTreeNode(v.Invoker.Name,TestNodeType.Invoker);
 *                              pipeNode.Nodes.Add(invokerNode);
 *                      }
 */
            return(pipeNode);
        }
Пример #23
0
        private TestTreeNode addNamespaceNodes(GuidTestTreeNodeDictionary nodes, RunPipeStarter pipeStarter)
        {
            RunPipe pipe = pipeStarter.Pipe;
            string  ns   = "";

            TestTreeNode parent     = this.parentNode;
            string       namespace_ = pipe.FixtureType.Namespace;

            if (namespace_ == null || namespace_.Length == 0)
            {
                namespace_ = "";
            }
            foreach (string name in namespace_.Split('.'))
            {
                if (ns.Length == 0)
                {
                    ns += name;
                }
                else
                {
                    ns += "." + name;
                }

                if (!this.namespaceNodes.Contains(ns))
                {
                    TestTreeNode node = new TestTreeNode(name, TestNodeType.Category);

                    this.namespaceNodes.Add(ns, node);
                    parent.Nodes.Add(node);
                    nodes.Add(node);
                    parent = node;
                }
                else
                {
                    parent = (TestTreeNode)this.namespaceNodes[ns];
                }
            }

            return(parent);
        }
        public void Test()
        {
            this.target = new NamespaceTestTreePopulator();
            this.dic    = new GuidTestTreeNodeDictionary();

            root = new TestTreeNode("root", TestNodeType.Category);

            AddPipe(typeof(MbUnit.Core.Remoting.Child1.DummyClass));
            AddPipe(typeof(MbUnit.Core.Remoting.Child2.DummyClass));

            Visit(root, "");

            Assert.AreEqual(1, root.Nodes.Count);

            TestTreeNode child = root.Nodes[0];

            Assert.AreEqual("Namespaces", child.Name);
            Assert.AreEqual(1, child.Nodes.Count);

            child = child.Nodes[0];
            Assert.AreEqual(1, child.Nodes.Count);
            Assert.AreEqual("MbUnit", child.Name);

            child = child.Nodes[0];
            Assert.AreEqual(1, child.Nodes.Count);
            Assert.AreEqual("Core", child.Name);

            child = child.Nodes[0];
            Assert.AreEqual("Remoting", child.Name);

            Assert.AreEqual(2, child.Nodes.Count);
            Assert.IsTrue((child.Nodes[0].Name == "Child1" && child.Nodes[1].Name == "Child2") ||
                          (child.Nodes[0].Name == "Child2" && child.Nodes[1].Name == "Child1")
                          );

            Assert.AreEqual(1, child.Nodes[0].Nodes.Count);
            Assert.AreEqual(1, child.Nodes[1].Nodes.Count);
            Assert.AreEqual("DummyClass", child.Nodes[0].Nodes[0].Name);
            Assert.AreEqual("DummyClass", child.Nodes[1].Nodes[0].Name);
        }
        public void Test()
        {
            this.target = new NamespaceTestTreePopulator();
            this.dic = new GuidTestTreeNodeDictionary();

            root = new TestTreeNode("root", TestNodeType.Category);

            AddPipe(typeof(MbUnit.Core.Remoting.Child1.DummyClass));
            AddPipe(typeof(MbUnit.Core.Remoting.Child2.DummyClass));

            Visit(root,"");

            Assert.AreEqual(1, root.Nodes.Count);

            TestTreeNode child = root.Nodes[0];
            Assert.AreEqual("Namespaces", child.Name);
            Assert.AreEqual(1, child.Nodes.Count);

            child = child.Nodes[0];
            Assert.AreEqual(1, child.Nodes.Count);
            Assert.AreEqual("MbUnit", child.Name);

            child = child.Nodes[0];
            Assert.AreEqual(1, child.Nodes.Count);
            Assert.AreEqual("Core", child.Name);

            child = child.Nodes[0];
            Assert.AreEqual("Remoting", child.Name);

            Assert.AreEqual(2, child.Nodes.Count);
            Assert.IsTrue((child.Nodes[0].Name == "Child1" && child.Nodes[1].Name == "Child2")
                || (child.Nodes[0].Name == "Child2" && child.Nodes[1].Name == "Child1")
                );

            Assert.AreEqual(1,child.Nodes[0].Nodes.Count);
            Assert.AreEqual(1,child.Nodes[1].Nodes.Count);
            Assert.AreEqual("DummyClass", child.Nodes[0].Nodes[0].Name);
            Assert.AreEqual("DummyClass", child.Nodes[1].Nodes[0].Name);
        }
Пример #26
0
		public override void Populate(
			GuidTestTreeNodeDictionary nodes, 
			TestTreeNode rootNode, 
			MbUnit.Core.Collections.RunPipeStarterCollection pipes
			)
		{
			if (rootNode==null)
				throw new ArgumentNullException("rootNode");
			if (pipes==null)
				throw new ArgumentNullException("pipes");

            if (this.parentNode == null)
            {
                this.parentNode = new TestTreeNode("Authors", TestNodeType.Populator);
                nodes.Add(this.parentNode);
                rootNode.Nodes.Add(this.parentNode);
                // add unknown author
                this.anonymous = this.addAuthor(nodes, "Anonymous");
            }

            foreach(RunPipeStarter pipeStarter in pipes)
			{
				// get author attribute
				TestTreeNode node = null;
                AuthorAttribute author = (AuthorAttribute)TypeHelper.TryGetFirstCustomAttribute(
                        pipeStarter.Pipe.FixtureType, typeof(AuthorAttribute));
                if (author!=null)
                	node = addAuthor(nodes,author.Name);
				else
					node = anonymous;

				TestTreeNode fixtureNode = addFixtureNode(nodes,node,pipeStarter);

				CreatePipeNode(nodes,fixtureNode,pipeStarter);
			}
		}
        private IEnumerable categoryNodesFrom(GuidTestTreeNodeDictionary nodes, Type fixtureType)
        {
            ArrayList catNodes = new ArrayList();

            foreach(FixtureCategoryAttribute cat in
                fixtureType.GetCustomAttributes(typeof(FixtureCategoryAttribute),true))
            {
                // get parent
                TestTreeNode catNode = this.addCategoryNodes(nodes,cat.Category);
                catNodes.Add(catNode);
            }

            return catNodes;
        }
 /// <summary>
 /// Populates the node using the <see cref="RunPipe"/> instance
 /// contained in <paramref name="pipes"/>.
 /// </summary>
 /// <exception cref="ArgumentNullException">
 /// <param name="root"/> or <paramref name="pipes"/> is a null
 /// reference (Nothing in Visual Basic)
 /// </exception>
 public abstract void Populate(GuidTestTreeNodeDictionary nodes, TestTreeNode root, RunPipeStarterCollection pipes);
        private TestTreeNode addCategoryNodes(GuidTestTreeNodeDictionary nodes, string category)
        {
            string ns = "";

            TestTreeNode parent = this.parentNode;
            foreach(string name in category.Split('.'))
            {
                if (ns.Length==0)
                    ns+=name;
                else
                    ns+="."+name;

                if (!this.categoryNodes.Contains(ns))
                {
                    TestTreeNode  node = new TestTreeNode(name,TestNodeType.Category);

                    nodes.Add(node);
                    this.categoryNodes.Add(ns,node);
                    parent.Nodes.Add(node);
                    parent = node;
                }
                else
                    parent = (TestTreeNode)this.categoryNodes[ns];
            }

            return parent;
        }
Пример #30
0
		private TestTreeNode addAuthor(
			GuidTestTreeNodeDictionary nodes, 
			string name)
		{
			TestTreeNode node = this.authorNodes[name];
			if (node==null)
			{
				node = new TestTreeNode(name,TestNodeType.Category);
				this.parentNode.Nodes.Add(node);
				nodes.Add(node);
				this.authorNodes.Add(name,node);
			}
			return node;
		}
Пример #31
0
 private TestTreeNode addTestsOn(
     GuidTestTreeNodeDictionary nodes,
     string testedTypeFullName)
 {
     TestTreeNode node = this.testedTypeNodes[testedTypeFullName];
     if (node == null)
     {
         node = new TestTreeNode(testedTypeFullName, TestNodeType.Category);
         this.parentNode.Nodes.Add(node);
         nodes.Add(node);
         this.testedTypeNodes.Add(testedTypeFullName, node);
     }
     return node;
 }
Пример #32
0
 /// <summary>
 /// Populates the node using the <see cref="RunPipe"/> instance
 /// contained in <paramref name="pipes"/>.
 /// </summary>
 /// <param name="nodes">Node dictionary.</param>
 /// <param name="root">The root node.</param>
 /// <param name="pipes">Collection of <see cref="RunPipeStarter"/>s</param>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="root"/> or <paramref name="pipes"/> is a null
 /// reference (Nothing in Visual Basic)
 /// </exception>
 public abstract void Populate(GuidTestTreeNodeDictionary nodes, TestTreeNode root, RunPipeStarterCollection pipes);
 private TestTreeNode addFixtureNode(GuidTestTreeNodeDictionary nodes, 
     TestTreeNode parentNode,
     RunPipeStarter pipeStarter)
 {
     RunPipe pipe = pipeStarter.Pipe;
     string key=pipe.FixtureName+parentNode.Name;
     if (!this.fixtureNodes.Contains(key))
     {
         TestTreeNode  fixtureNode = new TestTreeNode(pipe.FixtureName,TestNodeType.Fixture);
         this.fixtureNodes.Add(key,fixtureNode);
         nodes.Add(fixtureNode);
         parentNode.Nodes.Add(fixtureNode);
     }
     return (TestTreeNode)this.fixtureNodes[key];
 }
Пример #34
0
		private TestTreeNode addNamespaceNodes(GuidTestTreeNodeDictionary nodes, RunPipeStarter pipeStarter)
		{
			RunPipe pipe = pipeStarter.Pipe;
			string ns = "";
			
			TestTreeNode parent = this.parentNode;
			string namespace_ = pipe.FixtureType.Namespace;
			if (namespace_==null ||namespace_.Length==0)
				namespace_="";
			foreach(string name in namespace_.Split('.'))
			{
				if (ns.Length==0)
					ns+=name;
				else
					ns+="."+name;

				if (!this.namespaceNodes.Contains(ns))
				{
					TestTreeNode  node = new TestTreeNode(name,TestNodeType.Category);

					this.namespaceNodes.Add(ns,node);
					parent.Nodes.Add(node);
					nodes.Add(node);
					parent = node;
				}
				else
					parent = (TestTreeNode)this.namespaceNodes[ns];	
			}
			
			return parent;
		}	
 private TestTreeNode addImportance(
     GuidTestTreeNodeDictionary nodes,
     TestImportance importance)
 {
     TestTreeNode node = this.importanceNodes[importance.ToString()];
     if (node==null)
     {
         node = new TestTreeNode(importance.ToString(),TestNodeType.Category);
         this.parentNode.Nodes.Add(node);
         this.importanceNodes.Add(importance.ToString(),node);
         nodes.Add(node);
     }
     return node;
 }