How should inner classes and methods be tested?

Possible duplicate:
inner class testing

I like to have my test classes in a separate assembly, and this causes some problem when testing inner classes. Since inner classes and methods are visible only inside the assembly, my test assembly cannot see these classes and methods. What is the most efficient way to test these classes? Do I need to use reflection to access methods that I have not tested?

+3
source share
4 answers

You can use the InternalsVisbleTo attribute.

: ( ) ?

+6

- , , .

, , , TDD . , .

+1

, .

+1

, , .

If he is, he must have his own mission. And this mission can do something; for example, another state of the object.

So, while testing this “other” object, you may be able to indirectly test your inner class.

But a good start can be questioned if you really need to have this inner class. If you intend to write TTDD (Testable Test Driven Development), your design may require a different architecture.

0
source

Source: https://habr.com/ru/post/1775134/


All Articles