Add generic overload for `IFakeOptionsBuilder<T>.Implements`
See original GitHub issueCurrently, to implement an additional interface on a fake, we have to write this:
A.Fake<IFoo>(o => o.Implements(typeof(IBar))
It would be more convenient to write it like this:
A.Fake<IFoo>(o => o.Implements<IBar>())
It’s a minor change, but it contributes to make the API more fluent IMO.
The only drawback is that this overload has to be added to the IFakeOptionsBuilder<T>
interface, it can’t be an extension method. The reason is that the extension method would need to have 2 type parameters, and since it’s not possible to specify only one and let the compiler infer the other, we would have to specify both explicitly.
Issue Analytics
- State:
- Created 8 years ago
- Comments:13 (13 by maintainers)
Top Results From Across the Web
c# - Overloading generic methods
My suggestion to resolve that would be to define a generic interface ISaver<in T> with a non-generic method DoSave(T param) . Have the...
Read more >TypeScript — Generics and overloads
To overcome this problem, we're gonna use generics. Using Generic types. In languages like C# and Java, one of the main tools in...
Read more >1136 – Overloading a Generic Method
In the same way that you can overload a generic class, you can overload a generic method, defining multiple generic methods having the...
Read more >Generic traits as an alternative to method overloading : r/rust
I think its a great technique and implementing it really helps understand how traits work. It definitely helped clean up my maths operations....
Read more >proposal: spec: allow overloading generic functions strictly ...
This proposal suggests introducing support for function overloading with generic constraints in the Go programming language. The goal is to ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@thomaslevesque, thanks very much for your work on this issue. Don’t bother looking for your name in the release notes. 🔑
This issue has been fixed in release 2.0.0.
@thomaslevesque, I was wondering if you were going to catch that. I did feel bad that you didn’t make it onto the list, but I thought it would also look a little funny. That’s the price you pay for power, I guess.