We have a class a class that looks something like the following:
public class Processor
{
//set timeout in seconds
private const int TIMEOUT = 600;
public void Process()
{
//DO SOMETHING HERE
//CHECK TO SEE IF TIMEOUT HAS BEEN HIT
}
}
Essentially, we'd like to write a unit test to see if a timeout is experienced after the specified amount of time. Obviously, we don't want to have to wait 10 minutes each time we run tests. With this in mind, my question is:
How can we manage this value so that it could be, perhaps, 10 seconds during testing but 10 minutes in production? There are many obvious ways to do this, but I'm trying to determine what the cleanest way would be. Should we expose this as a property? Include it as a constructor parameter? Include it as a method parameter? Use compiler directives?