public bool TestTryCatchFinallyIL() {
      ITypeDefinition type = Helper.GetNamespaceType((IUnitNamespace)this.ModuleReaderTest.TestAssembly.NamespaceRoot, this.MethodBodyTest);
      IMethodDefinition method = Helper.GetMethodNamed(type, this.TryCatchFinallyHandlerMethod);
      StringILDasmPaper stringPaper = new StringILDasmPaper(2);
      ILDasmPrettyPrinter prettyPrinter = new ILDasmPrettyPrinter(stringPaper, this.ModuleReaderTest.TestAssembly);
      prettyPrinter.MethodDefinition(method);
      string result =
@".method private hidebysig instance explicit default void TryCatchFinallyHandlerMethod()cil managed
{
  .maxstack 1
  .locals init(
    [mscorlib]System.Exception  V_0
  )
  IL_0000:  nop
  IL_0001:  nop
  IL_0002:  newobj instance void[mscorlib]System.Object::.ctor()
  IL_0007:  pop
  IL_0008:  nop
  IL_0009:  leave.s IL_001c
  IL_000b:  stloc.0
  IL_000c:  nop
  IL_000d:  ldloc.0
  IL_000e:  callvirt instance[mscorlib]System.String[mscorlib]System.Object::ToString()
  IL_0013:  call static void[mscorlib]System.Console::WriteLine([mscorlib]System.String)
  IL_0018:  nop
  IL_0019:  nop
  IL_001a:  leave.s IL_001c
  IL_001c:  nop
  IL_001d:  leave.s IL_002d
  IL_001f:  nop
  IL_0020:  ldstr ""In Finally""
  IL_0025:  call static void[mscorlib]System.Console::WriteLine([mscorlib]System.String)
  IL_002a:  nop
  IL_002b:  nop
  IL_002c:  endfinally
  IL_002d:  nop
  IL_002e:  ret
  .try IL_0001 to IL_000b catch[mscorlib]System.Exception handler IL_000b to IL_001c
  .try IL_0001 to IL_001f finally handler IL_001f to IL_002d
}
";
      return result.Equals(stringPaper.Content);
    }
    public bool TestGenMethodType() {
      ITypeDefinition type = Helper.GetNamespaceType(this.ModuleReaderTest.ILAsmAssembly.UnitNamespaceRoot, this.Generic);
      IMethodDefinition method = Helper.GetMethodNamed(type, this.GenMethod);
      StringILDasmPaper stringPaper = new StringILDasmPaper(2);
      ILDasmPrettyPrinter prettyPrinter = new ILDasmPrettyPrinter(stringPaper, this.ModuleReaderTest.ILAsmAssembly);
      prettyPrinter.MethodDefinition(method);
      string result =
@".method public hidebysig instance explicit default!!0 GenMethod<class T>(
  !!0  t,
  !!0 modopt([mscorlib]System.Runtime.CompilerServices.IsConst)* tp
)cil managed
{
  .maxstack 3
  .locals init(
    !!0  V_0
  )
  IL_0000:  nop
  IL_0001:  ldarg.0
  IL_0002:  ldnull
  IL_0003:  ldc.i4.0
  IL_0004:  call instance!!0 Generic`1::GenMethod<[mscorlib]System.Object>(!!0,!!0 modopt([mscorlib]System.Runtime.CompilerServices.IsConst)*)
  IL_0009:  pop
  IL_000a:  ldarg.1
  IL_000b:  stloc.0
  IL_000c:  br.s IL_000e
  IL_000e:  ldloc.0
  IL_000f:  ret
}
";
      return result.Equals(stringPaper.Content);
    }
    public bool TestPtrToStringCharsMethod() {
      IMethodDefinition method = Helper.GetGlobalMethod((IUnitNamespace)this.ModuleReaderTest.CppAssembly.NamespaceRoot, this.PtrToStringChars);
      StringILDasmPaper stringPaper = new StringILDasmPaper(2);
      ILDasmPrettyPrinter prettyPrinter = new ILDasmPrettyPrinter(stringPaper, this.ModuleReaderTest.CppAssembly);
      prettyPrinter.MethodDefinition(method);
      string result =
@".method assembly static explicit default char modopt([mscorlib]System.Runtime.CompilerServices.IsConst)&modopt([mscorlib]System.Runtime.CompilerServices.IsExplicitlyDereferenced)PtrToStringChars(
  [mscorlib]System.String modopt([mscorlib]System.Runtime.CompilerServices.IsConst) s
)cil managed
{
  .maxstack 2
  .locals(
    unsigned int8&modopt([mscorlib]System.Runtime.CompilerServices.IsExplicitlyDereferenced) V_0
  )
  IL_0000:  ldarg.0
  IL_0001:  stloc.0
  IL_0002:  ldloc.0
  IL_0003:  brfalse.s IL_000d
  IL_0005:  call static int32[mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::get_OffsetToStringData()
  IL_000a:  ldloc.0
  IL_000b:  add
  IL_000c:  stloc.0
  IL_000d:  ldloc.0
  IL_000e:  ret
}
";
      return result.Equals(stringPaper.Content);
    }
    public bool TestfreeMethod() {
      IMethodDefinition method = Helper.GetGlobalMethod((IUnitNamespace)this.ModuleReaderTest.CppAssembly.NamespaceRoot, this.free);
      StringILDasmPaper stringPaper = new StringILDasmPaper(2);
      ILDasmPrettyPrinter prettyPrinter = new ILDasmPrettyPrinter(stringPaper, this.ModuleReaderTest.CppAssembly);
      prettyPrinter.MethodDefinition(method);
      string result =
@".method public static pinvokeimpl(MSVCR80.dll as free cdecl lasterr)explicit default void modopt([mscorlib]System.Runtime.CompilerServices.CallConvCdecl)free(
  void*
)cil managed preservesig
{
  .custom instance void[mscorlib]System.Security.SuppressUnmanagedCodeSecurityAttribute::.ctor()
  {
  }
}
";
      return result.Equals(stringPaper.Content);
    }
    public bool TestGenericTypeMethod() {
      ITypeDefinition assemType = Helper.GetNamespaceType(this.ModuleReaderTest.AssemblyAssembly.UnitNamespaceRoot, this.Assem);
      IFieldDefinition fld = Helper.GetFieldNamed(assemType, this.Generic1);
      ITypeDefinition type = fld.Type.ResolvedType;
      IMethodDefinition method = Helper.GetMethodNamed(type, this.get_propT);
      StringILDasmPaper stringPaper = new StringILDasmPaper(2);
      ILDasmPrettyPrinter prettyPrinter = new ILDasmPrettyPrinter(stringPaper, this.ModuleReaderTest.TestAssembly);
      prettyPrinter.MethodDefinition(method);
      string result =
@".method public hidebysig specialname instance explicit default int32 get_propT()cil managed
{
  .maxstack 1
  .locals init(
    int32  V_0,
    int32  V_1
  )
  IL_0000:  nop
  IL_0001:  ldloca.s V_1
  IL_0003:  initobj int32
  IL_0009:  ldloc.1
  IL_000a:  stloc.0
  IL_000b:  br.s IL_000d
  IL_000d:  ldloc.0
  IL_000e:  ret
}
";
      return result.Equals(stringPaper.Content);
    }
    public bool TestAssemGenericMethodCall() {
      ITypeDefinition type = Helper.GetNamespaceType((IUnitNamespace)this.ModuleReaderTest.AssemblyAssembly.NamespaceRoot, this.Assem);
      IMethodDefinition method = Helper.GetMethodNamed(type, this.GenMethod);
      IOperation op = Helper.GetOperation(method, 7);
      IMethodReference methodRef = op.Value as IMethodReference;
      if (methodRef == null)
        return false;
      IGenericMethodInstance gmi = methodRef.ResolvedMethod as IGenericMethodInstance;
      if (gmi == null)
        return false;
      StringILDasmPaper stringPaper = new StringILDasmPaper(2);
      ILDasmPrettyPrinter prettyPrinter = new ILDasmPrettyPrinter(stringPaper, this.ModuleReaderTest.TestAssembly);
      prettyPrinter.MethodDefinition(gmi);
      string result =
@".method public hidebysig instance explicit default[mscorlib]System.Object GenMethod<[mscorlib]System.Object>(
  [mscorlib]System.Object  t,
  [mscorlib]System.Collections.Generic.List`1<[mscorlib]System.Object> l,
  [mscorlib]System.Object[] ta,
  [mscorlib]System.Object[,] tm,
  [mscorlib]System.Object[,] tn
)cil managed
{
  .maxstack 6
  .locals init(
     V_0
  )
  IL_0000:  nop
  IL_0001:  ldarg.0
  IL_0002:  ldnull
  IL_0003:  ldnull
  IL_0004:  ldnull
  IL_0005:  ldnull
  IL_0006:  ldnull
  IL_0007:  call instance!!0[MRW_Assembly]Assem::GenMethod<[mscorlib]System.Object>(!!0,[mscorlib]System.Collections.Generic.List`1<!!0>,!!0[],!!0[,],!!0[,])
  IL_000c:  pop
  IL_000d:  ldarg.1
  IL_000e:  stloc.0
  IL_000f:  br.s IL_0011
  IL_0011:  ldloc.0
  IL_0012:  ret
}
";
      return result.Equals(stringPaper.Content);
    }
    public bool TestAssemGenericMethod() {
      ITypeDefinition type = Helper.GetNamespaceType((IUnitNamespace)this.ModuleReaderTest.AssemblyAssembly.NamespaceRoot, this.Assem);
      IMethodDefinition method = Helper.GetMethodNamed(type, this.GenMethod);
      StringILDasmPaper stringPaper = new StringILDasmPaper(2);
      ILDasmPrettyPrinter prettyPrinter = new ILDasmPrettyPrinter(stringPaper, this.ModuleReaderTest.TestAssembly);
      prettyPrinter.MethodDefinition(method);
      string result =
@".method public hidebysig instance explicit default!!0 GenMethod<class T>(
  !!0  t,
  [mscorlib]System.Collections.Generic.List`1<!!0> l,
  !!0[] ta,
  !!0[,] tm,
  !!0[,] tn
)cil managed
{
  .maxstack 6
  .locals init(
    !!0  V_0
  )
  IL_0000:  nop
  IL_0001:  ldarg.0
  IL_0002:  ldnull
  IL_0003:  ldnull
  IL_0004:  ldnull
  IL_0005:  ldnull
  IL_0006:  ldnull
  IL_0007:  call instance!!0[MRW_Assembly]Assem::GenMethod<[mscorlib]System.Object>(!!0,[mscorlib]System.Collections.Generic.List`1<!!0>,!!0[],!!0[,],!!0[,])
  IL_000c:  pop
  IL_000d:  ldarg.1
  IL_000e:  stloc.0
  IL_000f:  br.s IL_0011
  IL_0011:  ldloc.0
  IL_0012:  ret
}
";
      return result.Equals(stringPaper.Content);
    }
    public bool TestCreateFontIndirectArray() {
      ITypeDefinition type = Helper.GetNamespaceType((IUnitNamespace)this.ModuleReaderTest.TestAssembly.NamespaceRoot, this.MarshalTest);
      IMethodDefinition method = Helper.GetMethodNamed(type, this.CreateFontIndirectArray);
      StringILDasmPaper stringPaper = new StringILDasmPaper(2);
      ILDasmPrettyPrinter prettyPrinter = new ILDasmPrettyPrinter(stringPaper, this.ModuleReaderTest.TestAssembly);
      prettyPrinter.MethodDefinition(method);
      string result =
@".method public hidebysig static pinvokeimpl(gdi32.dll as CreateFontIndirectArray autochar winapi)explicit default native int CreateFontIndirectArray(
  [vjslib]com.ms.win32.LOGFONT[]marshal(lpstruct,0,1) lplf
)cil managed preservesig
{
}
";
      return result.Equals(stringPaper.Content);
    }
    public bool TestListAddMethodInstructions() {
      ITypeDefinition type = Helper.GetNamespaceType(Helper.GetNamespace(this.ModuleReaderTest.MscorlibAssembly, this.System, this.Collections, this.Generic), this.List);
      IMethodDefinition method = Helper.GetMethodNamed(type, this.Add);
      StringILDasmPaper stringPaper = new StringILDasmPaper(2);
      ILDasmPrettyPrinter prettyPrinter = new ILDasmPrettyPrinter(stringPaper, this.ModuleReaderTest.MscorlibAssembly);
      prettyPrinter.MethodDefinition(method);
      string result =
@".method public hidebysig newslot virtual final instance explicit default void Add(
  !0  item
)cil managed
{
  .maxstack 4
  .locals init(
    int32  V_0
  )
  IL_0000:  ldarg.0
  IL_0001:  ldfld int32 System.Collections.Generic.List`1<!0>::_size
  IL_0006:  ldarg.0
  IL_0007:  ldfld!0[]System.Collections.Generic.List`1<!0>::_items
  IL_000c:  ldlen
  IL_000d:  conv.i4
  IL_000e:  bne.un.s IL_001e
  IL_0010:  ldarg.0
  IL_0011:  ldarg.0
  IL_0012:  ldfld int32 System.Collections.Generic.List`1<!0>::_size
  IL_0017:  ldc.i4.1
  IL_0018:  add
  IL_0019:  call instance void System.Collections.Generic.List`1<!0>::EnsureCapacity(int32)
  IL_001e:  ldarg.0
  IL_001f:  ldfld!0[]System.Collections.Generic.List`1<!0>::_items
  IL_0024:  ldarg.0
  IL_0025:  dup
  IL_0026:  ldfld int32 System.Collections.Generic.List`1<!0>::_size
  IL_002b:  dup
  IL_002c:  stloc.0
  IL_002d:  ldc.i4.1
  IL_002e:  add
  IL_002f:  stfld int32 System.Collections.Generic.List`1<!0>::_size
  IL_0034:  ldloc.0
  IL_0035:  ldarg.1
  IL_0036:  stelem!0
  IL_003b:  ldarg.0
  IL_003c:  dup
  IL_003d:  ldfld int32 System.Collections.Generic.List`1<!0>::_version
  IL_0042:  ldc.i4.1
  IL_0043:  add
  IL_0044:  stfld int32 System.Collections.Generic.List`1<!0>::_version
  IL_0049:  ret
}
";
      return result.Equals(stringPaper.Content);
    }