Esempio n. 1
0
        public void Test()
        {
            var gen = new XmlResultsGenerator(null, null, null, null, null);

            var muSession = new MutationTestingSession();

            var mutar = new MutationTarget(new MutationVariant());


            var ass = new AssemblyNode("Assembly");

            muSession.MutantsGrouped.Add(ass);
            var nodeNamespace = new TypeNamespaceNode(ass, "Namespace");

            ass.Children.Add(nodeNamespace);
            var nodeType = new TypeNode(nodeNamespace, "Type");

            nodeNamespace.Children.Add(nodeType);
            var nodeMethod = new MethodNode(nodeType, "Method", null, true);

            nodeType.Children.Add(nodeMethod);
            var nodeGroup = new MutantGroup("Gr1", nodeMethod);

            nodeMethod.Children.Add(nodeGroup);
            var nodeMutant = new Mutant("m1", nodeGroup, mutar);

            nodeGroup.Children.Add(nodeMutant);

            XDocument generateResults = gen.GenerateResults(muSession, false, false, ProgressCounter.Inactive(), CancellationToken.None).Result;

            Console.WriteLine(generateResults.ToString());
            //gen.
        }
        public void Test()
        {
             var gen = new XmlResultsGenerator(null,null,null, null, null);

            var muSession = new MutationTestingSession();
            
            var mutar = new MutationTarget(new MutationVariant());


            var ass = new AssemblyNode("Assembly");
            muSession.MutantsGrouped.Add(ass);
            var nodeNamespace = new TypeNamespaceNode(ass, "Namespace");
            ass.Children.Add(nodeNamespace);
            var nodeType = new TypeNode(nodeNamespace, "Type");
            nodeNamespace.Children.Add(nodeType);
            var nodeMethod = new MethodNode(nodeType, "Method", null, true);
            nodeType.Children.Add(nodeMethod);
            var nodeGroup = new MutantGroup("Gr1", nodeMethod);
            nodeMethod.Children.Add(nodeGroup);
            var nodeMutant = new Mutant("m1", nodeGroup, mutar);
            nodeGroup.Children.Add(nodeMutant);

            XDocument generateResults = gen.GenerateResults(muSession, false, false, ProgressCounter.Inactive(), CancellationToken.None).Result;

            Console.WriteLine(generateResults.ToString());
            //gen.
        }
Esempio n. 3
0
 public Mutant CreateEquivalentMutant(out AssemblyNode assemblyNode)
 {
     
     assemblyNode = new AssemblyNode("All modules");
     var nsNode = new TypeNamespaceNode(assemblyNode, "");
     assemblyNode.Children.Add(nsNode);
     var typeNode = new TypeNode(nsNode, "");
     nsNode.Children.Add(typeNode);
     var methodNode = new MethodNode(typeNode, "", null, true);
     typeNode.Children.Add(methodNode);
     var group = new MutantGroup("Testing original program", methodNode);
     var target = new MutationTarget(new MutationVariant())
                  {
                      Name = "Original program",
                  };
     var mutant = new Mutant("0", group, target);
    
     group.Children.Add(mutant);
     methodNode.Children.Add(group);
     group.UpdateDisplayedText();
     return mutant;
 }
        public void RemoveFromParentIfEmpty(MutationNode node)
        {
            var children = node.Children.ToList();

            while (children.OfType <TypeNamespaceNode>().Any())
            {
                TypeNamespaceNode typeNamespaceNode = node.Children.OfType <TypeNamespaceNode>().First();
                RemoveFromParentIfEmpty(typeNamespaceNode);
                children.Remove(typeNamespaceNode);
            }
            while (children.OfType <TypeNode>().Any())
            {
                TypeNode typeNamespaceNode = node.Children.OfType <TypeNode>().First();
                RemoveFromParentIfEmpty(typeNamespaceNode);
                children.Remove(typeNamespaceNode);
            }
            if (!node.Children.Any())
            {
                node.Parent.Children.Remove(node);
                node.Parent = null;
            }
        }
Esempio n. 5
0
        public Mutant CreateEquivalentMutant(out AssemblyNode assemblyNode)
        {
            assemblyNode = new AssemblyNode("All modules");
            var nsNode = new TypeNamespaceNode(assemblyNode, "");

            assemblyNode.Children.Add(nsNode);
            var typeNode = new TypeNode(nsNode, "");

            nsNode.Children.Add(typeNode);
            var methodNode = new MethodNode(typeNode, "", null, true);

            typeNode.Children.Add(methodNode);
            var group  = new MutantGroup("Testing original program", methodNode);
            var target = new MutationTarget(new MutationVariant())
            {
                Name = "Original program",
            };
            var mutant = new Mutant("0", group, target);

            group.Children.Add(mutant);
            methodNode.Children.Add(group);
            group.UpdateDisplayedText();
            return(mutant);
        }