Exemple #1
0
        public void Stop_DisposesAsyncLoop()
        {
            var asyncLoop        = new Mock <IAsyncLoop>();
            var asyncLoopFactory = new Mock <IAsyncLoopFactory>();

            asyncLoopFactory.Setup(a => a.Run("Notify", It.IsAny <Func <CancellationToken, Task> >(), It.IsAny <CancellationToken>(), null, null))
            .Returns(asyncLoop.Object);

            var notification = new BlockNotification(this.LoggerFactory.Object, this.chain, this.consensusManager.Object, this.signals.Object, asyncLoopFactory.Object, this.lifetime);

            notification.Start();
            notification.Stop();

            asyncLoop.Verify(a => a.Dispose());
        }
        public void Stop_DisposesAsyncLoop()
        {
            var lifetime         = new NodeLifetime();
            var chain            = new Mock <ConcurrentChain>();
            var puller           = new Mock <ILookaheadBlockPuller>();
            var signals          = new Mock <ISignals>();
            var asyncLoop        = new Mock <IAsyncLoop>();
            var asyncLoopFactory = new Mock <IAsyncLoopFactory>();

            asyncLoopFactory.Setup(a => a.Run("Notify", It.IsAny <Func <CancellationToken, Task> >(), It.IsAny <CancellationToken>(), null, null))
            .Returns(asyncLoop.Object);

            var notification = new BlockNotification(this.LoggerFactory.Object, chain.Object, puller.Object, signals.Object, asyncLoopFactory.Object, lifetime);

            notification.Start();
            notification.Stop();

            asyncLoop.Verify(a => a.Dispose());
        }