4 ms·
C# has `InternalsVisibleTo` FWIW - though `internal` isn’t the same as `private` - but if you really want to unit-test private members you can always use reflec
by DaiPlusPlus 7y ago
C# has `InternalsVisibleTo` FWIW - though `internal` isn’t the same as `private` - but if you really want to unit-test private members you can always use reflection.
An OOP purist would tell you to abstract-out your fancy private logic into a DI-injected service that can then be tested separately.
- gmueckl 7y ago> An OOP purist would tell you to abstract-out your fancy private logic into a DI-injected service that can then be tested separately. Many OOP purists don't seem to think about ways the language itself could work differently to support them better. All these guys seem to remember is their set of favorite hammers.
- DaiPlusPlus 7y agoWell, consider composition-over-inheritance, traits and mixins - all of which require language support, otherwise you get horrible developer ergonomics issues like having to repeat interface implementations over and over - or build your own domain-level implementation of traits - which just wastes people’s time.