Working on a project where our system uses the nservicebus timeout to trigger an event every 24 hrs. Is it possible, through unit-testing, to “fake” the 24 hrs, so the test can be run at any given time, thus not having to wait for a day before the test will run?
Overridden timeout-method looks like this:
public override void Timeout(object state)
{
ExportFileGenerator.GenerateFile(_entryDataStore.GetEntriesOlderThan(DateTime.Now));
RequestUtcTimeout(TimeSpan.FromHours(TimeLeftToDailyJob()), "");
}
I’ve blogged about how to do this here:
http://www.udidahan.com/2012/02/27/nservicebus-saga-tips/