public void ExtensionAttribute_CanInvokeIfAllMatches() { attribute = new AttributeExt("key", expectedReturnType: typeof(int), expectedParams: new Type[] { typeof(string), typeof(float), typeof(Type) }); Assert.IsTrue(attribute.CanInvoke("key", typeof(int), new object[] { new Typester(), 42.0f, "abcAffeschnee" })); attribute = new AttributeExt("key", expectedReturnType: null); Assert.IsTrue(attribute.CanInvoke("key", null)); }
public void ExtensionAttribute_CanInvokeReturnsFalseIfParameterListCountMatchesYetTypesDoNotMatch() { attribute = new AttributeExt("key", expectedParams: new Type[] { typeof(string), typeof(int), typeof(string) }); Assert.IsFalse(attribute.CanInvoke("key", null, new object[] { 1, 2, 3 })); }
public void ExtensionAttribute_CanInvokeReturnsFalseOnFalseReturnType() { attribute = new AttributeExt("key", null); Assert.IsFalse(attribute.CanInvoke("key", typeof(int))); }
public void ExtensionAttribute_CanInvokeReturnsFalseIfParameterListDoesNotHaveSameCount() { attribute = new AttributeExt("key"); Assert.IsFalse(attribute.CanInvoke(12, parameters: new object[] { 1, 2, 3 })); }
public void ExtensionAttribute_CanInvokeReturnsFalseOnFalseKeyType() { attribute = new AttributeExt("key"); Assert.IsFalse(attribute.CanInvoke(12)); }