3 ms·
You don't necessarily need to implement interfaces [in your code] to stub them in unit tests: var calculator = Substitute.For<ICalculator>();
by orphea 1y ago
You 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.