Example #1
0
        public async Task StopAsync_Should_Log_If_Not_Running_Sync()
        {
            _deltaHeightWatcher = Substitute.For <IDeltaHeightWatcher>();
            _deltaHeightWatcher.GetHighestDeltaIndexAsync().Returns(new DeltaIndex {
                Cid = ByteString.Empty, Height = 10000
            });

            var sync = new Synchroniser(new SyncState(), _peerSyncManager, _deltaCache, _deltaHeightWatcher, _deltaHashProvider, _deltaDfsReader,
                                        _deltaIndexService, _mapperProvider, _userOutput, Substitute.For <ILogger>());

            await sync.StopAsync(CancellationToken.None);

            _userOutput.Received(1).WriteLine("Sync is not currently running.");

            sync.State.IsRunning.Should().BeFalse();
        }