3 ms·
> You can't just "go to definition" of the class being injected into yours, even if there is only one. Yes, I can? At least Rider can jump to the only implemen
by orphea 1y ago
> You can't just "go to definition" of the class being injected into yours, even if there is only one.
Yes, I can? At least Rider can jump to the only implementation, no questions asked.
> And no, it will not just point to your single implementation, it'll find the test implementation too.
It will, but is it a problem to click the correct class from a list of two options?
- jen20 1y agoIf you only have one implementation, why do you even have an interface?
- rawling 1y agoSo I can mock it out for unit tests.
- jen20 1y agoThen you have two implementations…
- orphea 1y agoYou don't necessarily need to implement interfaces [in your code] to stub them in unit tests: var calculator = Substitute.For<ICalculator>();
- jen20 1y agoIf you’re doing that, you may as just mock your concrete class. Mockito supports this in Java. Perhaps this is needed in C#?
- wordofx 1y agoJava is virtual by default. C# is not. You could mark every single method virtual and mock it like Java. But it’s easier to define a contract and mock that.
- rawling 1y agoNot one that shows up when I hit "go to implementation".
- wordofx 1y agoLOL ok so you’ve never used C#