public bool TestGeneric1Event() { ITypeDefinition genType = Helper.GetNamespaceType(this.ModuleReaderTest.AssemblyAssembly.UnitNamespaceRoot, this.Generic1); IEventDefinition eventDef = Helper.GetEventNamed(genType, this.GenericEvent); StringILDasmPaper stringPaper = new StringILDasmPaper(2); ILDasmPrettyPrinter prettyPrinter = new ILDasmPrettyPrinter(stringPaper, this.ModuleReaderTest.TestAssembly); prettyPrinter.EventDefinition(eventDef); string result = @".event public[MRW_Assembly]GenericDelegate`1<!0>GenericEvent { .addon instance void[MRW_Assembly]Generic1`1::add_GenericEvent([MRW_Assembly]GenericDelegate`1<!0>) .removeon instance void[MRW_Assembly]Generic1`1::remove_GenericEvent([MRW_Assembly]GenericDelegate`1<!0>) } "; return result.Equals(stringPaper.Content); }
public bool TestGenericTypeEvent() { ITypeDefinition assemType = Helper.GetNamespaceType(this.ModuleReaderTest.AssemblyAssembly.UnitNamespaceRoot, this.Assem); IFieldDefinition fld = Helper.GetFieldNamed(assemType, this.Generic1); ITypeDefinition type = fld.Type.ResolvedType; IEventDefinition eventDef = Helper.GetEventNamed(type, this.GenericEvent); StringILDasmPaper stringPaper = new StringILDasmPaper(2); ILDasmPrettyPrinter prettyPrinter = new ILDasmPrettyPrinter(stringPaper, this.ModuleReaderTest.TestAssembly); prettyPrinter.EventDefinition(eventDef); string result = @".event public[MRW_Assembly]GenericDelegate`1<int32>GenericEvent { .addon instance void[MRW_Assembly]Generic1`1<int32>::add_GenericEvent([MRW_Assembly]GenericDelegate`1<int32>) .removeon instance void[MRW_Assembly]Generic1`1<int32>::remove_GenericEvent([MRW_Assembly]GenericDelegate`1<int32>) } "; return result.Equals(stringPaper.Content); }
public bool TestGCClearCacheEvent() { ITypeDefinition type = Helper.GetNamespaceType(Helper.GetNamespace(this.ModuleReaderTest.MscorlibAssembly, this.System), this.GC); IEventDefinition eventDef = Helper.GetEventNamed(type, this.ClearCache); StringILDasmPaper stringPaper = new StringILDasmPaper(2); ILDasmPrettyPrinter prettyPrinter = new ILDasmPrettyPrinter(stringPaper, this.ModuleReaderTest.MscorlibAssembly); prettyPrinter.EventDefinition(eventDef); string result = @".event assembly System.Reflection.Cache.ClearCacheHandler ClearCache { .addon static void System.GC::add_ClearCache(System.Reflection.Cache.ClearCacheHandler) .removeon static void System.GC::remove_ClearCache(System.Reflection.Cache.ClearCacheHandler) } "; return result.Equals(stringPaper.Content); }