コード例 #1
0
        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));
        }
コード例 #2
0
        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);
        }