Esempio n. 1
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);
        }
        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);
                }
            }
        }
Esempio n. 3
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);
                }
            }
        }
Esempio n. 4
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);
            }
        }
		/// <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);
			}
		}
Esempio n. 6
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);
            }
        }
Esempio n. 7
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);
        }
        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);
        }
Esempio n. 9
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);
        }
Esempio n. 10
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]);
        }
Esempio n. 11
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]);
        }
 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;
 }
Esempio n. 13
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);
            }
        }
Esempio n. 15
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);
        }
Esempio n. 16
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);
        }
Esempio n. 17
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);
        }
Esempio n. 18
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 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;
 }
 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];
 }
		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;
        }
        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;
        }
Esempio n. 23
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;
 }
		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;
		}	
Esempio n. 25
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;
		}