One special note on mocking DateTime.Now
with TypeMock...
The value of DateTime.Now
must be placed into a variable for this to be mocked properly. For example:
This does not work:
if ((DateTime.Now - message.TimeOpened.Value) > new TimeSpan(1, 0, 0))
However, this does:
var currentDateTime = DateTime.Now;
if ((currentDateTime - message.TimeOpened.Value) > new TimeSpan(1, 0, 0))