public void CallableWithTest() { { var callables = AttributeScanner .GetMethodAttributes <TestCallableAttribute>() .CallableWith(MethodSignature.Params <IBase>()).ToList(); Assert.AreEqual(1, callables.Count); Assert.AreEqual(callables[0].Method.Name, nameof(CallableTypes.TakeBase)); } { var callables = AttributeScanner .GetMethodAttributes <TestCallableAttribute>() .CallableWith(MethodSignature.Params <IDerived>()).ToList(); Assert.AreEqual(2, callables.Count); Assert.AreEqual(callables[0].Method.Name, nameof(CallableTypes.TakeBase)); Assert.AreEqual(callables[1].Method.Name, nameof(CallableTypes.TakeDerived)); } { var callables = AttributeScanner .GetMethodAttributes <TestCallableAttribute>() .CallableWith(MethodSignature.Params <Concrete>()).ToList(); Assert.AreEqual(3, callables.Count); Assert.AreEqual(callables[0].Method.Name, nameof(CallableTypes.TakeBase)); Assert.AreEqual(callables[1].Method.Name, nameof(CallableTypes.TakeDerived)); Assert.AreEqual(callables[2].Method.Name, nameof(CallableTypes.TakeConcrete)); } { var callables = AttributeScanner .GetMethodAttributes <TestCallableAttribute>() .CallableWith(MethodSignature.Params <Ref <IBase> >()).ToList(); Assert.AreEqual(1, callables.Count); Assert.AreEqual(callables[0].Method.Name, nameof(CallableTypes.TakeBaseRef)); } { var callables = AttributeScanner .GetMethodAttributes <TestCallableAttribute>() .CallableWith(MethodSignature.Params <Ref <IDerived> >()).ToList(); Assert.AreEqual(2, callables.Count); Assert.AreEqual(callables[0].Method.Name, nameof(CallableTypes.TakeBaseRef)); Assert.AreEqual(callables[1].Method.Name, nameof(CallableTypes.TakeDerivedRef)); } { var callables = AttributeScanner .GetMethodAttributes <TestCallableAttribute>() .CallableWith(MethodSignature.Params <int>()).ToList(); Assert.AreEqual(1, callables.Count); Assert.AreEqual(callables[0].Method.Name, nameof(CallableTypes.TakeOptionalParameters)); } { var callables = AttributeScanner .GetMethodAttributes <TestCallableAttribute>() .CallableWith(MethodSignature.Params <IBase>()).ToList(); Assert.AreEqual(1, callables.Count); Assert.AreEqual(callables[0].Method.Name, nameof(CallableTypes.TakeBase)); } }