如何模拟以下方法:
public class TimeService : ITimeService
{
public void SetDelyEvent(int interval, bool reset, Action action)
{
var timer = new Timer {Interval = interval, AutoReset = reset};
timer.Elapsed += (sender, args) => action();
timer.Start();
}
}
我想调用给定的 ACTION。var stub = new Mock<ITimeService>();
stub .Setup(m => m.SetDelyEvent(100, false, ACTION));