public void Initialization_FromGenericMethod() { var typeArguments = new[] { ReflectionObjectMother.GetSomeType() }; var genericMethodDefinition = ReflectionObjectMother.GetSomeGenericMethodDefinition(); var method = CustomMethodInfoObjectMother.Create(_declaringType, genericMethodDefintion: genericMethodDefinition, typeArguments: typeArguments); Assert.That(method.IsGenericMethodDefinition, Is.False); var instantiation = new MethodOnTypeInstantiation(_declaringType, method); Assert.That(instantiation.IsGenericMethod, Is.True); Assert.That(instantiation.IsGenericMethodDefinition, Is.False); Assert.That(instantiation.GetGenericMethodDefinition(), Is.SameAs(genericMethodDefinition)); Assert.That(instantiation.GetGenericArguments(), Is.EqualTo(typeArguments)); }
public void SetUp() { _declaringType = CustomTypeObjectMother.Create(); _name = "abc"; _attributes = (MethodAttributes)7; _returnParameter = CustomParameterInfoObjectMother.Create(); _customMethod = new TestableCustomMethodInfo(_declaringType, _name, _attributes, null, Type.EmptyTypes) { ReturnParameter_ = _returnParameter }; _typeArgument = ReflectionObjectMother.GetSomeType(); _genericMethodUnderlyingDefinition = ReflectionObjectMother.GetSomeGenericMethodDefinition(); _genericMethod = CustomMethodInfoObjectMother.Create( genericMethodDefintion: _genericMethodUnderlyingDefinition, typeArguments: new[] { _typeArgument }); _typeParameter = ReflectionObjectMother.GetSomeGenericParameter(); _genericMethodDefinition = CustomMethodInfoObjectMother.Create(typeArguments: new[] { _typeParameter }); }