Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Conditional Compilation
Message
From
12/01/2009 09:29:22
 
 
To
All
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Conditional Compilation
Environment versions
Environment:
C# 3.0
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01372770
Message ID:
01372770
Views:
65
Hi.
I would like to use conditional compilation to have difference method access modifier for unit testing.
#if TEST
    public virtual void MyMethod()
#else
    public void MyMethod()
#endif
    {
        // Do Something;
    }
I have code as above, I added new constant TEST at solution configuration manager. I changed "constant" among debug, release and TEST. VS 2008 IDE works fine for TEST and debug. However, whenever I change it to release, the method under TEST constant will be used.

Anyway to make DEBUG/RELEASE to use public void MyMethod() and onyl TEST will use public virtual void MyMethod() ?

Thank you
I am not the most powerful man in this world.
I am not the worst man in this world either.
I just as same as all of you.
I still need to learn from my mistakes...
Next
Reply
Map
View

Click here to load this message in the networking platform