public void With_NullCallback_ThrowArgumentNullException() { var funcStub = It.IsNotNull <Func <object, CancellationToken, Task <object> > >(); Action <object> callbackStub = null; Assert.Throws <ArgumentNullException>(() => AsyncCallScheduler <object, object> .Create(funcStub, callbackStub)); }
public void AsyncCallScheduler_ManyCalls_SingleCall(TimeSpan betweenInterval, Action <Action> caller) { var paramStub = It.IsNotNull <object>(); var funcMock = new Mock <Func <object, CancellationToken, Task <object> > >(); var callbackStub = new Mock <Action <object> >(); var callScheduler = AsyncCallScheduler <object, object> .Create(funcMock.Object, callbackStub.Object); caller(() => callScheduler.ScheduleCall(paramStub, betweenInterval)); funcMock.Verify(func => func.Invoke(It.IsAny <object>(), It.IsAny <CancellationToken>()), Times.Once); }