public void DeclaringTypeGenericParameter_ProperlyCalls_ClosedGenericMethod() { var instance = new ObscenelyAnnoyingGenericClass <ClassA>(); var parameter = new ClassA(); var expected = MethodReference.Get(() => instance.Method(parameter)); var methodResult = Build <Action <object, object> >(expected.Name, overrideType: instance.GetType()).WithParameters(parameter).Build(); methodResult(instance, parameter); Assert.Equal(expected: expected.MetadataToken, instance.LastCall.MetadataToken); }
public void DeclaringTypeGenericTypeParam_ThenMethodGenericParam_ProperlyCalls_Method() { var instance = new ObscenelyAnnoyingGenericClass <ClassA>(); var parameter1 = new ClassA(); int parameter2 = 1; var expected = MethodReference.Get(() => instance.Method <int>(parameter1, parameter2)); var methodResult = Build <Action <object, object, int> >(expected.Name, overrideType: instance.GetType()) .WithParameters(parameter1, parameter2) .WithMethodGenerics(typeof(int)) .Build(); methodResult(instance, parameter1, parameter2); Assert.Equal(expected: expected.MetadataToken, instance.LastCall.MetadataToken); }