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


C# Module.LoadDebugInformation方法代码示例

本文整理汇总了C#中Module.LoadDebugInformation方法的典型用法代码示例。如果您正苦于以下问题:C# Module.LoadDebugInformation方法的具体用法?C# Module.LoadDebugInformation怎么用?C# Module.LoadDebugInformation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Module的用法示例。


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

示例1: Module_Loads_Debug_Information_For_Mono

        public void Module_Loads_Debug_Information_For_Mono()
        {
            var module = new Module(typeof(TestClassMono).Assembly.Location);
            Assert.IsTrue(module.Definition.Types
                .Single(t => t.Name == "TestClassMono")
                .Methods.Single(m => m.Name == "Run")
                .Body.Instructions.All(i => i.SequencePoint == null));
            module.LoadDebugInformation();
//            Assert.IsTrue(module.Definition.Types
//                .Single(t => t.Name == "TestClassMono")
//                .Methods.Single(m => m.Name == "Run")
//                .Body.Instructions.Any(i => i.SequencePoint != null));
        }
开发者ID:dbremner,项目名称:ninjaturtles,代码行数:13,代码来源:ModuleTests.cs

示例2: ShouldReportSequencePoint_Kicks_Out_Nop_Only

        public void ShouldReportSequencePoint_Kicks_Out_Nop_Only()
        {
            var module = new Module(typeof(ArithmeticOperatorTurtle).Assembly.Location);
            module.LoadDebugInformation();

            var turtle = module.Definition.Types
                .Single(t => t.Name == typeof(ArithmeticOperatorTurtle).Name);

            var methodDefinition = turtle.Methods.Single(m => m.Name == Methods.CONSTRUCTOR);

            var instruction = methodDefinition
                .Body.Instructions.Where(i => i.SequencePoint != null)
                .Skip(1).First();

            Assert.IsFalse(instruction.ShouldReportSequencePoint());
        }
开发者ID:dbremner,项目名称:ninjaturtles,代码行数:16,代码来源:InstructionExtensionsTests.cs

示例3: Mutate_Multiple_Delegates_Identifies_All_Delegate_Methods

        public void Mutate_Multiple_Delegates_Identifies_All_Delegate_Methods()
        {
            var module = new Module(typeof(ClosureClassUnderTest).Assembly.Location);
            module.LoadDebugInformation();

            var turtle = new DummyTurtle();
            var method = module.Definition.Types
                .Single(t => t.Name == "ClosureClassUnderTest")
                .Methods.Single(m => m.Name == "AddMultipleDelegates");

            //act
            var mutations = turtle.Mutate(method, module, method.Body.Instructions.Select(i => i.Offset).ToArray()).ToList();

            //assert
            Assert.AreEqual(3, mutations.Count, "mutations.Count");
            var delegateMethod = mutations[2].MethodDefinition;
            Assert.IsTrue(delegateMethod.Name.StartsWith("<AddMultipleDelegates>"));
            Assert.AreEqual(2, delegateMethod.Parameters.Count, "third mutated method should be second delegate");
        }
开发者ID:dbremner,项目名称:ninjaturtles,代码行数:19,代码来源:MethodTurtleBaseTests.cs

示例4: Mutate_Delegate_Resolves_And_Numbers_Source_Code

        public void Mutate_Delegate_Resolves_And_Numbers_Source_Code()
        {
            var module = new Module(typeof(ClosureClassUnderTest).Assembly.Location);
            module.LoadDebugInformation();

            var turtle = new DummyTurtle();
            var method = module.Definition.Types
                .Single(t => t.Name == "ClosureClassUnderTest")
                .Methods.Single(m => m.Name == "ReturnsDelegate");

            var enumerator = turtle.Mutate(method, module, method.Body.Instructions.Select(i => i.Offset).ToArray()).GetEnumerator();
            Assert.IsTrue(enumerator.MoveNext());
            Assert.IsTrue(enumerator.MoveNext());

            Assert.AreEqual(@"  35:         public Func<int, int, int> ReturnsDelegate()
  36:         {
  37:             return (l, r) => l + r;
  38:         }
  39: ".Replace("\r\n", "\n").Replace("\n", Environment.NewLine), enumerator.Current.GetOriginalSourceCode(enumerator.Current.ILIndex));
        }
开发者ID:dbremner,项目名称:ninjaturtles,代码行数:20,代码来源:MethodTurtleBaseTests.cs

示例5: Mutate_Closure_Identifies_Closure_Method

        public void Mutate_Closure_Identifies_Closure_Method()
        {
            var module = new Module(typeof(ClosureClassUnderTest).Assembly.Location);
            module.LoadDebugInformation();

            var turtle = new DummyTurtle();
            var method = module.Definition.Types
                .Single(t => t.Name == "ClosureClassUnderTest")
                .Methods.Single(m => m.Name == "AddClosure");

            //act
            var mutations = turtle.Mutate(method, module, method.Body.Instructions.Select(i => i.Offset).ToArray()).ToList();

            //assert
            Assert.AreEqual(2, mutations.Count, "mutations.Count");
            var closureMethod = mutations[1].MethodDefinition;
            Assert.IsTrue(closureMethod.Name.StartsWith("<AddClosure>"));
        }
开发者ID:dbremner,项目名称:ninjaturtles,代码行数:18,代码来源:MethodTurtleBaseTests.cs

示例6: Mutate_Resolves_And_Numbers_Source_Code

        public void Mutate_Resolves_And_Numbers_Source_Code()
        {
            var module = new Module(typeof(AdditionClassUnderTest).Assembly.Location);
            module.LoadDebugInformation();
            
            var turtle = new DummyTurtle();
            var method = module.Definition.Types
                .Single(t => t.Name == "AdditionClassUnderTest")
                .Methods.Single(m => m.Name == "Add");

                //act
            var mutation = turtle.Mutate(method, module, method.Body.Instructions.Select(i => i.Offset).ToArray()).First();
            
                //assert
                Assert.AreEqual(@"  30: 
  31:         public int Add(int left, int right)
  32:         {
  33:             return left + right;
  34:         }".Replace("\r\n", "\n").Replace("\n", Environment.NewLine), mutation.GetOriginalSourceCode(mutation.ILIndex));
            
        }
开发者ID:dbremner,项目名称:ninjaturtles,代码行数:21,代码来源:MethodTurtleBaseTests.cs

示例7: Mutate_Simplifies_Macros_In_Nested_Classes

        public void Mutate_Simplifies_Macros_In_Nested_Classes()
        {
            var module = new Module(typeof(ConditionalBoundaryTurtle).Assembly.Location);
            module.LoadDebugInformation();

            var method = module.Definition
                .Types.Single(t => t.Name == "ConditionalBoundaryTurtle")
                .Methods.Single(t => t.Name == "CreateMutant");

            var nestedMethod = method.DeclaringType
                .NestedTypes.Single(t => t.Name.StartsWith("<CreateMutant>"))
                .Methods.Single(t => t.Name == "MoveNext");

            var turtle = new DummyTurtle();
            bool expanded = false;
            foreach (var mutantMetaData in turtle.Mutate(method, module, method.Body.Instructions.Select(i => i.Offset).ToArray()))
            {
                if (mutantMetaData.MethodDefinition.Name == "MoveNext")
                {
                    Assert.AreEqual(OpCodes.Ldarg, nestedMethod.Body.Instructions.First().OpCode);
                    expanded = true;
                }
            }

            Assert.IsTrue(expanded);
            Assert.AreEqual(OpCodes.Ldarg_0, nestedMethod.Body.Instructions.First().OpCode);
        }
开发者ID:dbremner,项目名称:ninjaturtles,代码行数:27,代码来源:MethodTurtleBaseTests.cs

示例8: Module_Does_Not_Error_With_No_Debug_Information

 public void Module_Does_Not_Error_With_No_Debug_Information()
 {
     var module = new Module(typeof(TestClassNoPdb).Assembly.Location);
     Assert.IsTrue(module.Definition.Types
         .Single(t => t.Name == "TestClassNoPdb")
         .Methods.Single(m => m.Name == "Run")
         .Body.Instructions.All(i => i.SequencePoint == null));
     module.LoadDebugInformation();
     Assert.IsTrue(module.Definition.Types
         .Single(t => t.Name == "TestClassNoPdb")
         .Methods.Single(m => m.Name == "Run")
         .Body.Instructions.All(i => i.SequencePoint == null));
 }
开发者ID:dbremner,项目名称:ninjaturtles,代码行数:13,代码来源:ModuleTests.cs

示例9: Module_Loads_Source_File_List

 public void Module_Loads_Source_File_List()
 {
     var module = new Module(typeof(MutationTest).Assembly.Location);
     module.LoadDebugInformation();
     Assert.NotNull(module.SourceFiles.SingleOrDefault(s => s.Key.Contains("MutationTest.cs")));
 }
开发者ID:dbremner,项目名称:ninjaturtles,代码行数:6,代码来源:ModuleTests.cs

示例10: ShouldReportSequencePoint_Kicks_Out_Base_Constructor_Call_When_Simplified

        public void ShouldReportSequencePoint_Kicks_Out_Base_Constructor_Call_When_Simplified()
        {
            var module = new Module(typeof(ArithmeticOperatorTurtle).Assembly.Location);
            module.LoadDebugInformation();

            var turtle = module.Definition.Types
                .Single(t => t.Name == typeof(ArithmeticOperatorTurtle).Name);

            var methodDefinition = turtle.Methods.Single(m => m.Name == Methods.CONSTRUCTOR);
            methodDefinition.Body.SimplifyMacros();

            var instruction = methodDefinition
                .Body.Instructions
                .First(i => i.SequencePoint != null);

            Assert.IsFalse(instruction.ShouldReportSequencePoint());
        }
开发者ID:dbremner,项目名称:ninjaturtles,代码行数:17,代码来源:InstructionExtensionsTests.cs


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