当前位置: 首页>>代码示例>>C#>>正文


C# AssemblyNode类代码示例

本文整理汇总了C#中AssemblyNode的典型用法代码示例。如果您正苦于以下问题:C# AssemblyNode类的具体用法?C# AssemblyNode怎么用?C# AssemblyNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AssemblyNode类属于命名空间,在下文中一共展示了AssemblyNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Test

        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.
        }
开发者ID:Refresh06,项目名称:visualmutator,代码行数:27,代码来源:XmlResultsGeneratorTests.cs

示例2: Test1

        public void Test1()
        {
            System.Action<CheckedNode, ICollection<MutationTarget>> typeNodeCreator = (parent, targets) =>
            {

            };

            Func<MutationTarget, string> namespaceExtractor = target => target.NamespaceName;

            var mt1 = new MutationTarget(null);
            mt1.NamespaceName = "Root.NamespaceName1";

            var mt2 = new MutationTarget(null);
            mt2.NamespaceName = "Root.NamespaceName2";

            var mt3 = new MutationTarget(null);
            mt3.NamespaceName = "Another.NamespaceName3";

            var mt4 = new MutationTarget(null);
            mt4.NamespaceName = "Another.NamespaceName3";

            var ass = new AssemblyNode("");
            NamespaceGrouper<MutationTarget, CheckedNode>.
                GroupTypes(ass, namespaceExtractor,
                (parent, name) => new TypeNamespaceNode(parent, name), typeNodeCreator,
                    new List<MutationTarget> { mt1, mt2, mt3 });

            ass.Children.Count.ShouldEqual(2);
            ass.Children.Single(c => c.Name == "Root").Children.Count.ShouldEqual(2);
            ass.Children.Single(c => c.Name == "Another.NamespaceName3").Children.Count.ShouldEqual(0);
        }
开发者ID:Refresh06,项目名称:visualmutator,代码行数:31,代码来源:NamespaceGrouperTests.cs

示例3: DrawTree

		public void DrawTree(AssemblyNode module)
		{
			var leftCol = leftTree.Items.SourceCollection as INotifyCollectionChanged;
			leftCol.CollectionChanged += BuildLeftINodeList;
			
			var topCol = topTree.Items.SourceCollection as INotifyCollectionChanged;
			topCol.CollectionChanged += BuildTopINodeList;
			
			leftTree.MouseMove += LeftTree_MouseMove;
			topTree.MouseMove += TopTree_MouseMove;
			
			Helper.FillTree(leftTree, module);
			Helper.FillTree(topTree, module);
		}
开发者ID:nylen,项目名称:SharpDevelop,代码行数:14,代码来源:TreeMatrixControl.xaml.cs

示例4: CreateAssemblyNode

        public AssemblyNode CreateAssemblyNode(IModuleInfo module,
            CciMethodMatcher methodMatcher)
        {
            var matcher = methodMatcher.Join(new SolutionTypesManager.ProperlyNamedMatcher());
            var assemblyNode = new AssemblyNode(module.Name);
            assemblyNode.AssemblyPath = module.Module.Location.ToFilePathAbs();
            System.Action<CheckedNode, ICollection<INamedTypeDefinition>> typeNodeCreator = (parent, leafTypes) =>
            {
                foreach (INamedTypeDefinition typeDefinition in leafTypes)
                {
                    if (matcher.Matches(typeDefinition))
                    {
                        var type = new TypeNode(parent, typeDefinition.Name.Value);
                        foreach (var method in typeDefinition.Methods)
                        {
                            if (matcher.Matches(method))
                            {
                                type.Children.Add(new MethodNode(type, method.Name.Value, method, false));
                                return;
                            }
                        }
                        parent.Children.Add(type);
                    }
                }
            };
            Func<INamedTypeDefinition, string> namespaceExtractor = typeDef =>
                TypeHelper.GetDefiningNamespace(typeDef).Name.Value;


            NamespaceGrouper<INamespaceTypeDefinition, CheckedNode>.
                GroupTypes(assemblyNode,
                    namespaceExtractor,
                    (parent, name) => new TypeNamespaceNode(parent, name),
                    typeNodeCreator,
                        module.Module.GetAllTypes().ToList());


            //remove empty amespaces. 
            //TODO to refactor...
            List<TypeNamespaceNode> checkedNodes = assemblyNode.Children.OfType<TypeNamespaceNode>().ToList();
            foreach (TypeNamespaceNode node in checkedNodes)
            {
                RemoveFromParentIfEmpty(node);
            }
            return assemblyNode;
        }
开发者ID:Refresh06,项目名称:visualmutator,代码行数:46,代码来源:LimitedScopeStrategy.cs

示例5: MetricsReader

		public MetricsReader(string fileName)
		{
			loader = new CecilLoader(true) { IncludeInternalMembers = true };
			namespaceMappings = new Dictionary<string, NamespaceNode>();
			typeMappings = new Dictionary<ITypeDefinition, TypeNode>();
			methodMappings = new Dictionary<IMethod, MethodNode>();
			fieldMappings = new Dictionary<IField, FieldNode>();
			cecilMappings = new Dictionary<MemberReference, IEntity>();
			
			compilation = new SimpleCompilation(loader.LoadAssemblyFile(fileName));
			
			// TODO load referenced assemblies into compilation.
			
			Assembly = new AssemblyNode(compilation.MainAssembly.AssemblyName);
			assemblyDefinition = loader.GetCecilObject(compilation.MainAssembly.UnresolvedAssembly);
			
			foreach (var type in compilation.MainAssembly.GetAllTypeDefinitions()) {
				ReadType(type);
				
				foreach (IMethod method in type.Methods) {
					ReadMethod(method);
				}
				
				foreach (IProperty property in type.Properties) {
					if (property.CanGet)
						ReadMethod(property.Getter);
					if (property.CanSet)
						ReadMethod(property.Setter);
				}
				
				foreach (IField field in type.Fields) {
					ReadField(field);
				}
			}
			
			foreach (var method in methodMappings.Values) {
				ReadInstructions(method, method.Method, loader.GetCecilObject((IUnresolvedMethod)method.Method.UnresolvedMember));
			}
			
			Assembly.namespaces = namespaceMappings.Values;
		}
开发者ID:nylen,项目名称:SharpDevelop,代码行数:41,代码来源:MetricsReader.cs

示例6: CreateEquivalentMutant

 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;
 }
开发者ID:buchu73,项目名称:visualmutator,代码行数:22,代码来源:MutantsContainer.cs

示例7: VisitUnknownAssemblyAttribute

 public virtual AttributeNode VisitUnknownAssemblyAttribute(TypeNode attrType, AttributeNode attr, AssemblyNode target) {
   return attr;
 }
开发者ID:hesam,项目名称:SketchSharp,代码行数:3,代码来源:Checker.cs

示例8: VisitCompilation

 public override Compilation VisitCompilation(Compilation compilation) {
   if (compilation == null) return null;
   this.currentOptions = compilation.CompilerParameters as CompilerOptions;
   Module module = this.currentModule = compilation.TargetModule;
   if (module != null) {
     AssemblyNode assem = module as AssemblyNode;
     if (assem != null) {
       this.currentAssembly = assem;
       if (this.currentOptions.IsContractAssembly) { // handle compiler option /shadow:<assembly>
         this.shadowedAssembly = AssemblyNode.GetAssembly(this.currentOptions.ShadowedAssembly);
         if (this.shadowedAssembly == null) {
           this.HandleError(compilation, Error.CannotLoadShadowedAssembly, this.currentOptions.ShadowedAssembly);
           return compilation;
         }
         assem.Attributes.Add(ShadowedAssemblyAttribute());
         this.isCompilingAContractAssembly = true;
       }
       assem.Attributes = this.VisitAttributeList(assem.Attributes, assem);
       assem.ModuleAttributes = this.VisitModuleAttributes(assem.ModuleAttributes);
     } else {
       this.currentAssembly = module.ContainingAssembly;
       module.Attributes = this.VisitModuleAttributes(module.Attributes);
     }
   }
   return base.VisitCompilation(compilation);
 }
开发者ID:hesam,项目名称:SketchSharp,代码行数:26,代码来源:Checker.cs

示例9: GetType

 private TypeNode GetType(AssemblyNode assembly, string ns, string name)
 {
     var res = assembly.GetType(Identifier.For(ns), Identifier.For(name));
     if (res == null)
     {
         Log(new InvalidInteropMessage(null, "can't load required type: " + ns + "." + name));
         throw new ExitException();
     }
     return res;
 }
开发者ID:modulexcite,项目名称:IL2JS,代码行数:10,代码来源:RewriterEnvironment.cs

示例10: GetTypeNode

        private static TypeNode GetTypeNode(AssemblyNode assembly, string ns, string name)
        {
            Contract.Assert(assembly != null);

            return assembly.GetType(Identifier.For(ns), Identifier.For(name));
        }
开发者ID:ZhaoYngTest01,项目名称:WebApi,代码行数:6,代码来源:TypeNodeExtensions.cs

示例11: BuildMutantsTree

        private AssemblyNode BuildMutantsTree(string moduleName,
            MultiDictionary<IMutationOperator, MutationTarget> mutationTargets)
        {

            var assemblyNode = new AssemblyNode(moduleName);

            System.Action<CheckedNode, ICollection<MutationTarget>> typeNodeCreator = (parent, targets) =>
            {
                var typeNodes =
                    from t in targets
                    orderby t.TypeName
                    group t by t.TypeName
                    into byTypeGrouping
                    select new TypeNode(parent, byTypeGrouping.Key,
                        from gr in byTypeGrouping
                        group gr by gr.MethodRaw.Name.Value
                        into byMethodGrouping
                        orderby byMethodGrouping.Key
                        let md = byMethodGrouping.First().MethodRaw
                        select new MethodNode(md.Name.Value, md,
                            from gr in byMethodGrouping
                            group gr by gr.GroupName
                            into byGroupGrouping
                            orderby byGroupGrouping.Key
                            select GroupOrMutant(byGroupGrouping)
                        )
                    );

                parent.Children.AddRange(typeNodes);
            };

            Func<MutationTarget, string> namespaceExtractor = target => target.NamespaceName;

            NamespaceGrouper<MutationTarget, CheckedNode>.GroupTypes(assemblyNode, 
                namespaceExtractor, 
                (parent, name) => new TypeNamespaceNode(parent, name), 
                typeNodeCreator,
                mutationTargets.Values.SelectMany(a => a).ToList());


            foreach (var node in assemblyNode.Children.Where(n=>n.Children.Count == 0).ToList())
            {
                assemblyNode.Children.Remove(node);
            }
            return assemblyNode;
        }
开发者ID:buchu73,项目名称:visualmutator,代码行数:46,代码来源:MutantsContainer.cs

示例12: VisitAssembly

 public virtual AssemblyNode VisitAssembly(AssemblyNode assembly){
   if (assembly == null) return null;
   this.VisitModule(assembly);
   assembly.ModuleAttributes = this.VisitAttributeList(assembly.ModuleAttributes);
   assembly.SecurityAttributes = this.VisitSecurityAttributeList(assembly.SecurityAttributes);
   return assembly;
 }
开发者ID:dbremner,项目名称:specsharp,代码行数:7,代码来源:StandardVisitor.cs

示例13: VisitAssembly

		public virtual void VisitAssembly (AssemblyNode node)
		{
			if (node == null)
				return;

			VisitModuleList (node.Modules);
		}
开发者ID:carrie901,项目名称:mono,代码行数:7,代码来源:NodeInspector.cs

示例14: VisitAssembly

 public virtual void VisitAssembly(AssemblyNode assembly)
 {
   if (assembly == null) return;
   this.VisitModule(assembly);
   this.VisitAttributeList(assembly.ModuleAttributes);
   this.VisitSecurityAttributeList(assembly.SecurityAttributes);
 }
开发者ID:a780201,项目名称:CodeContracts,代码行数:7,代码来源:Inspector.cs

示例15: BaseQuery

		public BaseQuery(AssemblyNode mainModule)
		{
			MainModule = mainModule;
		}
开发者ID:nylen,项目名称:SharpDevelop,代码行数:4,代码来源:BaseQuery.cs


注:本文中的AssemblyNode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。