File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -104,7 +104,8 @@ private static void Initialize()
104104 {
105105 if ( _options . mockCallsInAllTypes || type . IsDefined ( typeof ( MockNativeCallsAttribute ) ) )
106106 {
107- foreach ( var method in type . GetRuntimeMethods ( ) )
107+ foreach ( var method in type . GetRuntimeMethods ( ) . Cast < MethodBase > ( )
108+ . Concat ( type . GetConstructors ( BindingFlags . Instance | BindingFlags . Static | BindingFlags . Public | BindingFlags . NonPublic ) ) )
108109 {
109110 if ( ! ( method is DynamicMethod ) && method . DeclaringType == type && method . GetMethodBody ( ) != null )
110111 {
@@ -200,8 +201,7 @@ private static IEnumerable<CodeInstruction> CallingMethodTranspiler(IEnumerable<
200201 {
201202 if ( instr . opcode == OpCodes . Call )
202203 {
203- var nativeMethod = ( MethodInfo ) instr . operand ;
204- if ( _nativeFunctionsToMock . Contains ( nativeMethod ) )
204+ if ( instr . operand is MethodInfo nativeMethod && _nativeFunctionsToMock . Contains ( nativeMethod ) )
205205 {
206206 if ( ! _nativeCallMocks . TryGetValue ( nativeMethod , out var newMethod ) )
207207 {
You can’t perform that action at this time.
0 commit comments