Use This To Unit Test Your Internal Types

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

You can use wildcard characters when defining your InternalsVisibleTo attributes.

zbaktube
Автор

I personally prefer using the InternalsVisibleTo attribute.

PRIMALmarauder
Автор

We made rules but also exceptions so you can damage the code and data but only if you put it in a test. Lol

airkami
Автор

Unfortunately it is a pain point to make frequent changes to project files in a team scenario because it makes merge conflict resolutions more likely to be needed.

stephendgreen
Автор

Can the behavior of the internal type be tested via a public type that uses it? IMO it’s best not to expose internal types because that could make refactoring more difficult, but maybe there are exceptional cases. Ian Cooper talks about this in his talk “TDD, Where Did It Go Wrong?”

SlowAside
Автор

@MilanJovanovicTech I have a situation for which I would know your position. I needed to test private stuff of a target class, I used inheritance and created a test class to test private things. How would you do in this situation? Also this approach is not possible for sealed classes.

georgeritchie
Автор

I know it's just me, but internal types are dumb. Just create a new namespace level and make them public there if you want to indicate that types aren't for direct usage.

Internal types are such a dumb pointless barrier.

orterves