feat: add generic tests to ReflectionTests#2195
Conversation
89a9066 to
c91213c
Compare
c91213c to
b5cca4d
Compare
|
Okay, converted to Suggestion: _mockHandler
.Fallback
.Respond("application/json", nameof(IBasicApi.GetParam)); |
|
Yeah, if its a good use case in our new Refit.Testing framework with the ability to fallback please add it. The refit mocking framework is more flat, so more you add in lists/actions rather than fluent style, so if you can keep that style when adding this new feature that'd be awesome. |
|
eg our goal with Testing is a decent mock framework that is perf/alloc focused but still easy to use, that anyone using refit can then use in their test framework (so it needs to be test framework agnostic also) |
|
Thanks for making the issue for the fallback, seems like a good first issue TBH. I'm fairly confident that the error I've been having is a bug, see #2197. Thankfully I think this issue will be unintentionally fixed once Refit is 100% source generated, as the language/compiler will handle disambiguating method overloads and not Refit. I suspect the bug has existed in Refit for a very long time, but no one has noticed up until now. 😅 |
3184841 to
1bc9915
Compare
1bc9915 to
d9e0b81
Compare
|
Fixed the tests by renaming one of the method overloads, hopefully when #2197 is fixed we can changed it back. |
|
ready for a merge? |
Yup, hopefully haven't forgotten any test cases 👍 |
Add test for overloads of the same method with different generic type overloads. Think I've found a possible bug with generic interfaces support
Both
GetGenericParameter<T1>(T1 @value1)andGetGenericParameter<T1>(T1 @value1, TInterface @value2)result in the error:No suitable Method found... at Refit.RequestBuilderImplementation.FindMatchingRestMethodInfo(String key, Type[] parameterTypes, Type[] genericArgumentTypes) in