Arne Rasmussen said:
Thank you for all your help everybody - however i still have a couple of
questions. The system i'm going to use NUnit within is a system allmost in
its final state - and noone tought of using Nunit in the planning state - so
now i'm faced with the problem that all of the calculations i have to test -
are realized in private methods in inherited or abstract clases - and NUnit
is VERY much NOT happy about testing these sorts of methods - is there any
...elegant way - to go about that ???
You have essentially two options to do what you want - unless you want to
change private methods to public, which is not a very good idea.
Like Julie suggested you could put the test fixture in the application
assembly and make the methods that are to be tested internal. This is not
very nice though as then you're polluting the application assembly with
extra code that has nothing to do with the actual functionality provided by
the assembly.
Another way would be to place the test fixtures in their own assemblies and
call the methods to be tested via reflection. This is admittably a bit more
coding and does not look very pretty, but this way you would avoid putting
extra code in the application assemblies.
Finally, some people believe that you should not be testing private methods
directly anyway. Instead, tests should exercise the public interface of
classes which would then end up testing private methods indirectly.
Regards,
Sami