public void TestTryCatchNop() { var ctx = _patchContext.AcquireContext(); ctx.GetPattern(TryCatchTest._target).Transpilers.Add(_nopTranspiler); _patchContext.Commit(); Assert.False(TryCatchTest.Target()); Assert.True(TryCatchTest.FinallyHit); _patchContext.FreeContext(ctx); _patchContext.Commit(); }
public void TestTryCatchCancel() { var ctx = _patchContext.AcquireContext(); ctx.GetPattern(TryCatchTest._target).Transpilers.Add(TryCatchTest._removeThrowTranspiler); ctx.GetPattern(TryCatchTest._target).DumpTarget = @"C:\tmp\dump.txt"; ctx.GetPattern(TryCatchTest._target).DumpMode = MethodRewritePattern.PrintModeEnum.Original | MethodRewritePattern.PrintModeEnum.Patched; _patchContext.Commit(); Assert.True(TryCatchTest.Target()); Assert.True(TryCatchTest.FinallyHit); _patchContext.FreeContext(ctx); _patchContext.Commit(); }