On 21 Jun 2006 07:38:52 -0700, "Q. John Chen" <qj****@email.c om>
wrote:
It is great to have an automated testing during development.
BUT,
How can I build the production release without nunit being included?
THX.
John
p.s. I posted this in nunit group but seems there are not much activity
there.
While keeping the test code in a seperate assembly is the recommended
way, it is pretty easy to do it in one assembly.
Just use the #if statement like this.
#if DEBUG
public class TestCode
{
//
}
#endif
Note, that the NUnit dlls will still be included in the build, but
removing them manually (or not including them in the setup) works
fine. Unless the JIT compiler actually needs the dlls, it won't miss
them.
A somewhat nicer alternative is to place all NUnit specific code in
another assembly, and only place the minimal amount of test code that
is needed to call internal/private methods inside the code assembly
(That test code should still be surrounded by #if DEBUG though). It is
a good compromise in my opinion, unless you want to use reflection to
do tests.
--
Marcus Andrén