I have some strange code in a web service.
#if SCALABILITYTESTING
Random r = new Random();
#endif
I’ve done a few searches on Google but found nothing useful. The web service is written in C#. The project it is in, has Microsoft Unit Tests.
Obviously, it’s saying if this variable is true then create a new random number, and my guess is that when I run the Microsoft Unit tests then this is triggered.
I’ve not seen anything like this before so I’d like to know what it is.
The only other clue I have is the following bit of code, which is at the very top of the page.
//#define SCALABILITYTESTING
#define SOAPSECURITY
#define SOFTWAREFEATURES
Visual Studio highlights #define.
I don’t know if the stackoverflow question below is related and my guess is that this is something similar to the DEBUG and TRACE constants.
Define new compile-time constant in C# (for #if)
EDIT
I’ve found these links which seem related.
http://msdn.microsoft.com/en-us/library/yt3yck0x.aspx
http://msdn.microsoft.com/en-us/library/4y6tbswk.aspx
The question is related and it is similar to DEBUG and TRACE. This is a conditional compilation symbol. These can be defined in the project properties or directly in the code with
#define.I assume, that the developer defined it, to change the way his tests or the code itself worked to simulate multiple users accessing the web service at once – or similar.