Exemplo n.º 1
0
        void UpdateTextEditor(CodeCoverageTreeNode node)
        {
            CodeCoverageClassTreeNode    classNode    = node as CodeCoverageClassTreeNode;
            CodeCoverageMethodTreeNode   methodNode   = node as CodeCoverageMethodTreeNode;
            CodeCoveragePropertyTreeNode propertyNode = node as CodeCoveragePropertyTreeNode;

            if (classNode != null && classNode.Nodes.Count > 0)
            {
                propertyNode = classNode.Nodes[0] as CodeCoveragePropertyTreeNode;
                methodNode   = classNode.Nodes[0] as CodeCoverageMethodTreeNode;
            }

            if (propertyNode != null && propertyNode.Nodes.Count > 0)
            {
                methodNode = propertyNode.Nodes[0] as CodeCoverageMethodTreeNode;
            }

            if (methodNode != null && methodNode.Method.SequencePoints.Count > 0)
            {
                CodeCoverageSequencePoint sequencePoint = methodNode.Method.SequencePoints[0];
                if (sequencePoint.HasDocument())
                {
                    if (classNode == null)
                    {
                        OpenFile(sequencePoint.Document, sequencePoint.Line, sequencePoint.Column);
                    }
                    else
                    {
                        OpenFile(sequencePoint.Document, 1, 1);
                    }
                }
            }
        }
        protected override void Initialize()
        {
            Nodes.Clear();

            // Add methods.
            CodeCoveragePropertyCollection properties = new CodeCoveragePropertyCollection();

            foreach (CodeCoverageMethod method in Methods)
            {
                // method name that is generated by compiler, contains "__" (double underscore)
                if (!method.Name.Contains("__"))
                {
                    if (method.IsProperty)
                    {
                        properties.Add(method);
                    }
                    else
                    {
                        CodeCoverageMethodTreeNode node = new CodeCoverageMethodTreeNode(method);
                        node.AddTo(this);
                    }
                }
            }

            // Add properties.s
            foreach (CodeCoverageProperty property in properties)
            {
                CodeCoveragePropertyTreeNode node = new CodeCoveragePropertyTreeNode(property);
                node.AddTo(this);
            }

            // Sort nodes.
            SortChildNodes();
        }
		protected override void Initialize()
		{
			Nodes.Clear();

			// Add methods.
			CodeCoveragePropertyCollection properties = new CodeCoveragePropertyCollection();
			foreach (CodeCoverageMethod method in Methods) {
				// method name that is generated by compiler, contains "__" (double underscore)
				if ( !method.Name.Contains("__") ) {
					if (method.IsProperty) {
						properties.Add(method);
					} else {
						CodeCoverageMethodTreeNode node = new CodeCoverageMethodTreeNode(method);
						node.AddTo(this);
					}
				}
			}
			
			// Add properties.s
			foreach (CodeCoverageProperty property in properties) {
				CodeCoveragePropertyTreeNode node = new CodeCoveragePropertyTreeNode(property);
				node.AddTo(this);
			}
			
			// Sort nodes.
			SortChildNodes();
		}
		public void Init()
		{
			List<CodeCoverageModule> modules = new List<CodeCoverageModule>();
			CodeCoverageModule fooModule = new CodeCoverageModule("Foo.Tests");
			CodeCoverageMethod fooTestMethod = new CodeCoverageMethod("FooTest", "Foo.Tests.FooTestFixture");
			fooTestMethod.SequencePoints.Add(new CodeCoverageSequencePoint("c:\\Projects\\Foo\\FooTestFixture.cs", 0, 1, 0, 2, 1, 1));
			fooTestMethod.SequencePoints.Add(new CodeCoverageSequencePoint("c:\\Projects\\Foo\\FooTestFixture.cs", 0, 2, 2, 3, 4, 1));

			fooModule.Methods.Add(fooTestMethod);
					
			modules.Add(fooModule);
			
			using (CodeCoverageTreeView treeView = new CodeCoverageTreeView()) {
				treeView.AddModules(modules);
				nodes = treeView.Nodes;
			}
			
			fooModuleNode = (CodeCoverageModuleTreeNode)nodes[0];
			
			fooModuleNode.Expanding();
			fooNamespaceTreeNode = (CodeCoverageNamespaceTreeNode)fooModuleNode.Nodes[0];
			
			fooNamespaceTreeNode.Expanding();
			fooTestsNamespaceTreeNode = (CodeCoverageNamespaceTreeNode)fooNamespaceTreeNode.Nodes[0];
			
			fooTestsNamespaceTreeNode.Expanding();
			fooTestFixtureTreeNode = (CodeCoverageClassTreeNode)fooTestsNamespaceTreeNode.Nodes[0];
			
			fooTestFixtureTreeNode.Expanding();
			fooTestMethodTreeNode = (CodeCoverageMethodTreeNode)fooTestFixtureTreeNode.Nodes[0];
		}
        protected override void Initialize()
        {
            Nodes.Clear();

            // Add methods.
            CodeCoveragePropertyCollection properties = new CodeCoveragePropertyCollection();

            foreach (CodeCoverageMethod method in Methods)
            {
                if (method.IsProperty)
                {
                    properties.Add(method);
                }
                else
                {
                    CodeCoverageMethodTreeNode node = new CodeCoverageMethodTreeNode(method);
                    node.AddTo(this);
                }
            }

            // Add properties.s
            foreach (CodeCoverageProperty property in properties)
            {
                CodeCoveragePropertyTreeNode node = new CodeCoveragePropertyTreeNode(property);
                node.AddTo(this);
            }

            // Sort nodes.
            SortChildNodes();
        }
		protected override void Initialize()
		{			
			Nodes.Clear();

			// Add methods.
			foreach (CodeCoverageMethod method in Methods) {
				CodeCoverageMethodTreeNode node = new CodeCoverageMethodTreeNode(method);
				node.AddTo(this);
			}
		}
Exemplo n.º 7
0
        protected override void Initialize()
        {
            Nodes.Clear();

            // Add methods.
            foreach (CodeCoverageMethod method in Methods)
            {
                CodeCoverageMethodTreeNode node = new CodeCoverageMethodTreeNode(method);
                node.AddTo(this);
            }
        }
Exemplo n.º 8
0
 void AddClassTreeNode(CodeCoverageClassTreeNode node)
 {
     foreach (CodeCoverageTreeNode childNode in node.Nodes)
     {
         CodeCoverageMethodTreeNode   method   = childNode as CodeCoverageMethodTreeNode;
         CodeCoveragePropertyTreeNode property = childNode as CodeCoveragePropertyTreeNode;
         if (method != null)
         {
             AddSequencePoints(method.Method.SequencePoints);
         }
         else
         {
             AddPropertyTreeNode(property);
         }
     }
 }
		public void SetUpFixture()
		{
			List<CodeCoverageModule> modules = new List<CodeCoverageModule>();
			CodeCoverageModule fooModule = new CodeCoverageModule("Tests");
			
			XElement setterMethod = CreateSetterElement("Tests.FooTest", "Count");
			fooSetterMethod = new CodeCoverageMethod("Tests.FooTest", setterMethod);
			fooSetterMethod.SequencePoints.Add(new CodeCoverageSequencePoint("c:\\Projects\\Foo\\FooTest.cs", 1, 2, 2, 3, 4, 2));
			fooSetterMethod.SequencePoints.Add(new CodeCoverageSequencePoint("c:\\Projects\\Foo\\FooTest.cs", 0, 3, 4, 4, 4, 1));
			
			XElement getterMethod = CreateGetterElement("Tests.FooTest", "Count");
			fooGetterMethod = new CodeCoverageMethod("Tests.FooTest", getterMethod);
			fooGetterMethod.SequencePoints.Add(new CodeCoverageSequencePoint("c:\\Projects\\Foo\\FooTest.cs", 1, 1, 0, 2, 1, 1));
				
			fooModule.Methods.Add(fooGetterMethod);
			fooModule.Methods.Add(fooSetterMethod);
			
			modules.Add(fooModule);
			
			using (CodeCoverageTreeView treeView = new CodeCoverageTreeView()) {
				treeView.AddModules(modules);
				fooModuleNode = (CodeCoverageModuleTreeNode)treeView.Nodes[0];
			}

			fooModuleNode.Expanding();
			
			fooTestsNamespaceTreeNode = (CodeCoverageNamespaceTreeNode)fooModuleNode.Nodes[0];

			fooTestsNamespaceTreeNode.Expanding();
			fooTestTreeNode = (CodeCoverageClassTreeNode)fooTestsNamespaceTreeNode.Nodes[0];

			fooTestTreeNode.Expanding();
			if (fooTestTreeNode.Nodes.Count > 0) {
				countPropertyTreeNode = fooTestTreeNode.Nodes[0] as CodeCoveragePropertyTreeNode;
			}
			
			countPropertyTreeNode.Expanding();
			if (countPropertyTreeNode != null && countPropertyTreeNode.Nodes.Count > 1) {
				fooGetterTreeNode = (CodeCoverageMethodTreeNode)countPropertyTreeNode.Nodes[0];
				fooSetterTreeNode = (CodeCoverageMethodTreeNode)countPropertyTreeNode.Nodes[1];
			}
		}
		public void Init()
		{
			CodeCoverageMethod method = new CodeCoverageMethod("FileElementHasAttributeNamedType", "AbstractElementSchemaTestFixture");
			module = new CodeCoverageModule("XmlEditor.Tests");
			module.Methods.Add(method);
			List<CodeCoverageModule> modules = new List<CodeCoverageModule>();
			modules.Add(module);
			
			TreeNodeCollection nodes;
			using (CodeCoverageTreeView treeView = new CodeCoverageTreeView()) {
				treeView.AddModules(modules);
				nodes = treeView.Nodes;
			}
			
			CodeCoverageModuleTreeNode moduleNode = (CodeCoverageModuleTreeNode)nodes[0];
			moduleNode.Expanding();
			CodeCoverageClassTreeNode classNode = (CodeCoverageClassTreeNode)moduleNode.Nodes[0];
			classNode.Expanding();
			methodNode = (CodeCoverageMethodTreeNode)classNode.Nodes[0];
		}
		public void SetUpFixture()
		{
			List<CodeCoverageModule> modules = new List<CodeCoverageModule>();
			CodeCoverageModule fooModule = new CodeCoverageModule("Foo.Tests");
			CodeCoverageMethod fooTestMethod1 = new CodeCoverageMethod("FooTest1", "Foo.Tests.FooTestFixture");
			fooTestMethod1.SequencePoints.Add(new CodeCoverageSequencePoint("c:\\Projects\\Foo\\FooTestFixture.cs", 1, 1, 0, 2, 1));
			fooTestMethod1.SequencePoints.Add(new CodeCoverageSequencePoint("c:\\Projects\\Foo\\FooTestFixture.cs", 0, 2, 2, 3, 4));
			CodeCoverageMethod fooTestMethod2 = new CodeCoverageMethod("FooTest2", "Foo.Tests.FooTestFixture");
			CodeCoverageMethod helperMethod = new CodeCoverageMethod("GetCoverageFile", "Foo.Tests.Util.Helper");
				
			fooModule.Methods.Add(fooTestMethod1);
			fooModule.Methods.Add(fooTestMethod2);
			fooModule.Methods.Add(helperMethod);
			
			CodeCoverageModule barModule = new CodeCoverageModule("Bar.Tests");
			
			modules.Add(barModule);
			modules.Add(fooModule);
			
			using (CodeCoverageTreeView treeView = new CodeCoverageTreeView()) {
				treeView.AddModules(modules);
				nodes = treeView.Nodes;
			}
			
			barModuleNode = (CodeCoverageModuleTreeNode)nodes[0];
			fooModuleNode = (CodeCoverageModuleTreeNode)nodes[1];
				
			fooModuleNode.Expanding();
			fooNamespaceTreeNode = (CodeCoverageNamespaceTreeNode)fooModuleNode.Nodes[0];
			
			fooNamespaceTreeNode.Expanding();
			fooTestsNamespaceTreeNode = (CodeCoverageNamespaceTreeNode)fooNamespaceTreeNode.Nodes[0];

			fooTestsNamespaceTreeNode.Expanding();
			fooTestsUtilNamespaceTreeNode = (CodeCoverageNamespaceTreeNode)fooTestsNamespaceTreeNode.Nodes[0];
			fooTestFixtureTreeNode = (CodeCoverageClassTreeNode)fooTestsNamespaceTreeNode.Nodes[1];

			fooTestFixtureTreeNode.Expanding();		
			fooTestMethod1TreeNode = (CodeCoverageMethodTreeNode)fooTestFixtureTreeNode.Nodes[0];
			fooTestMethod2TreeNode = (CodeCoverageMethodTreeNode)fooTestFixtureTreeNode.Nodes[1];
		}
 public override void ActivateItem()
 {
     if (Nodes.Count > 0)
     {
         CodeCoverageMethodTreeNode methodNode = Nodes[0] as CodeCoverageMethodTreeNode;
         if (methodNode != null && methodNode.Method.SequencePoints.Count > 0)
         {
             FileService.OpenFile(methodNode.Method.SequencePoints[0].Document);
         }
         // when the first node is a property:
         CodeCoverageMethodsTreeNode methodsNode = Nodes[0] as CodeCoverageMethodsTreeNode;
         if (methodsNode != null && methodsNode.Methods.Count > 0)
         {
             var sequencePoints = methodsNode.Methods[0].SequencePoints;
             if (sequencePoints != null)
             {
                 FileService.OpenFile(sequencePoints[0].Document);
             }
         }
     }
 }
Exemplo n.º 13
0
        void UpdateTextEditor(CodeCoverageTreeNode node)
        {
            CodeCoverageClassTreeNode  classNode  = node as CodeCoverageClassTreeNode;
            CodeCoverageMethodTreeNode methodNode = node as CodeCoverageMethodTreeNode;

            if (classNode != null && classNode.Nodes.Count > 0)
            {
                methodNode = (CodeCoverageMethodTreeNode)classNode.Nodes[0];
            }

            if (methodNode != null && methodNode.Method.SequencePoints.Count > 0)
            {
                CodeCoverageSequencePoint sequencePoint = methodNode.Method.SequencePoints[0];
                if (classNode == null)
                {
                    OpenFile(sequencePoint.Document, sequencePoint.Line - 1, sequencePoint.Column - 1);
                }
                else
                {
                    OpenFile(sequencePoint.Document, 1, 1);
                }
            }
        }
        public override void ActivateItem()
        {
            foreach (CodeCoverageTreeNode node in Nodes)
            {
                CodeCoverageMethodTreeNode  methodNode  = node as CodeCoverageMethodTreeNode;
                CodeCoverageMethodsTreeNode methodsNode = node as CodeCoverageMethodsTreeNode;

                bool openedFile = false;
                if (methodNode != null)
                {
                    openedFile = OpenFile(methodNode.Method.SequencePoints);
                }
                else if ((methodsNode != null) && (methodsNode.Methods.Count > 0))
                {
                    openedFile = OpenFile(methodsNode.Methods[0].SequencePoints);
                }

                if (openedFile)
                {
                    break;
                }
            }
        }
Exemplo n.º 15
0
 void UpdateListView(CodeCoverageTreeNode node)
 {
     listView.BeginUpdate();
     try {
         listView.Items.Clear();
         CodeCoverageClassTreeNode    classNode    = node as CodeCoverageClassTreeNode;
         CodeCoverageMethodTreeNode   methodNode   = node as CodeCoverageMethodTreeNode;
         CodeCoveragePropertyTreeNode propertyNode = node as CodeCoveragePropertyTreeNode;
         if (classNode != null)
         {
             AddClassTreeNode(classNode);
         }
         else if (methodNode != null)
         {
             AddSequencePoints(methodNode.Method.SequencePoints);
         }
         else if (propertyNode != null)
         {
             AddPropertyTreeNode(propertyNode);
         }
     } finally {
         listView.EndUpdate();
     }
 }
		protected override void Initialize()
		{
			Nodes.Clear();

			// Add methods.
			CodeCoveragePropertyCollection properties = new CodeCoveragePropertyCollection();
			foreach (CodeCoverageMethod method in Methods) {
				if (method.IsProperty) {
					properties.Add(method);
				} else {
					CodeCoverageMethodTreeNode node = new CodeCoverageMethodTreeNode(method);
					node.AddTo(this);
				}
			}
			
			// Add properties.s
			foreach (CodeCoverageProperty property in properties) {
				CodeCoveragePropertyTreeNode node = new CodeCoveragePropertyTreeNode(property);
				node.AddTo(this);
			}
			
			// Sort nodes.
			SortChildNodes();
		}
		public void GetterPropertyCompareString()
		{
			CodeCoverageMethod getterMethod = new CodeCoverageMethod("get_Aardvark", "Animal");
			CodeCoverageMethodTreeNode getterNode = new CodeCoverageMethodTreeNode(getterMethod);
			Assert.AreEqual("Aardvark get", getterNode.CompareString);
		}
		public void SetterPropertyCompareString()
		{
			CodeCoverageMethod setterMethod = new CodeCoverageMethod("set_Aardvark", "Animal");
			CodeCoverageMethodTreeNode setterNode = new CodeCoverageMethodTreeNode(setterMethod);
			Assert.AreEqual("Aardvark set", setterNode.CompareString);
		}