我有一个需要测试的方法,并且在该方法内部调用了相同的基类方法。要编写单元测试,我需要模拟/存根这个'base.ResolveDate(comparisonSeries,targetDate)'方法吗?我该怎么做?我不认为在这里提取接口会起作用!
public override DateTime ResolveDate(ISeries comparisonSeries, DateTime targetDate)
{
if (comparisonSeries == null)
{
throw new ArgumentNullException("comparisonSeries");
}
switch (comparisonSeries.Key)
{
case SeriesKey.R1:
case SeriesKey.R2:
case SeriesKey.R3:
case SeriesKey.R4:
case SeriesKey.R5:
return DateHelper.PreviousOrCurrentQuarterEnd(targetDate);
}
return base.ResolveDate(comparisonSeries, targetDate);
}