I'm in the process of evaluating typemock. Here is my question
util.GetConfigItem("DontMock", ref historyFromDaysAgo);
util.GetConfigItem("Mock", ref historyBeginHours);
util.GetConfigItem("DontMock1", ref historyEndHours);
util.GetConfigItem("Whatever1", ref extendedHours2Show);
util.GetConfigItem("Mock1", ref historyBeginHours);
util.GetConfigItem("whatever2", ref extendedHours2Show);
Util is a static class, and I only want to fake this method when the parameter is Mock or Mock1. I tried something like this
int configIntVal = 0;
Isolate.WhenCalled(() => util.GetConfigItem("Mock", ref configIntVal)).WithExactArguments().DoInstead((callContext) =>
{
int? retVal = callContext.Parameters[1] as int?;
string configItem = callContext.Parameters[0] as string;
callContext.Parameters[1] = 2;
});
it will call this fake method all the time, what is the best way to handle something like this