我正在创建一个存根接口并将其传递给我的测试方法,如下所示。我正在对传递给测试方法的接口(StubISeries)进行存根。如果comparisonSeries.Key
只是接口中的获取,我可以在存根中设置值而不向接口添加设置属性吗?
var series = new SomeNameSpace.Fakes.StubISeries();
series.Key = something to set the key here?
DateTime date = formReport.ResolveDate(series, DateTime.Now);
public override DateTime ResolveDate(ISeries comparisonSeries, DateTime targetDate)
{
switch (comparisonSeries.Key)
{
case SeriesKey.SomeKey1:
case SeriesKey.SomeKey2:
case SeriesKey.SomeKey3:
case SeriesKey.SomeKey4:
case SeriesKey.SomeKey5:
return DateHelper.PreviousOrCurrentQuarterEnd(targetDate);
default:
break;
}
return base.ResolveDate(comparisonSeries, targetDate);
}