예제 #1
0
    public void SingleMethod()
    {
        var assemblyPath = FixtureHelper.IsolateAssembly <StandardAssemblyToProcessReference>();
        var type         = typeof(MethodRefTestCases);
        var methodName   = nameof(MethodRefTestCases.ReturnMethodHandle);

        using var module = ModuleDefinition.ReadModule(assemblyPath);
        var weavingContext = new ModuleWeavingContext(module, new WeaverConfig(null, module));

        var typeDef   = module.GetTypes().Single(i => i.FullName == type.FullName);
        var methodDef = typeDef.Methods.Single(i => i.Name == methodName);

        new MethodWeaver(weavingContext, methodDef, NoOpLogger.Instance).Process();
    }
예제 #2
0
    static InvalidAssemblyToProcessFixture()
    {
        var weavingTask = new ModuleWeaver();

        TestResult = weavingTask.ExecuteTestRun(
            FixtureHelper.IsolateAssembly <InvalidAssemblyToProcessReference>(),
            false,
            beforeExecuteCallback: AssemblyToProcessFixture.BeforeExecuteCallback
            );

        using var assemblyResolver = new TestAssemblyResolver();

        ResultModule = ModuleDefinition.ReadModule(TestResult.AssemblyPath, new ReaderParameters(ReadingMode.Immediate)
        {
            AssemblyResolver = assemblyResolver
        });
    }