예제 #1
0
        public void Can_write_report_update()
        {
            ISyncPeer        syncPeer     = Substitute.For <ISyncPeer>();
            IEthSyncPeerPool syncPeerPool = Substitute.For <IEthSyncPeerPool>();
            PeerInfo         peer1        = new PeerInfo(syncPeer);

            peer1.IsInitialized = false;

            PeerInfo peer2 = new PeerInfo(syncPeer);

            peer2.IsInitialized = true;

            PeerInfo[] peers = new PeerInfo[] { peer1, peer2 };
            syncPeerPool.PeerCount.Returns(peers.Length);

            syncPeerPool.AllPeers.Returns(peers);

            SyncPeersReport report = new SyncPeersReport(syncPeerPool, Substitute.For <INodeStatsManager>(), NoErrorLimboLogs.Instance);

            report.WriteShortReport();
            report.WriteFullReport();

            peer1.IsInitialized = true;
            report.WriteShortReport();
            report.WriteFullReport();
        }
예제 #2
0
        public void Can_write_no_peers()
        {
            ISyncPeerPool   syncPeerPool = Substitute.For <ISyncPeerPool>();
            SyncPeersReport report       = new SyncPeersReport(syncPeerPool, Substitute.For <INodeStatsManager>(), NoErrorLimboLogs.Instance);

            report.WriteShortReport();
            report.WriteFullReport();
        }
예제 #3
0
        public void Can_write_report_update_with_allocations()
        {
            ISyncPeerPool syncPeerPool = Substitute.For <ISyncPeerPool>();
            var           syncPeer     = BuildPeer(false);
            var           syncPeer2    = BuildPeer(true);

            var peers = new[] { syncPeer, syncPeer2 };

            syncPeerPool.PeerCount.Returns(peers.Length);

            syncPeerPool.AllPeers.Returns(peers);

            SyncPeersReport report = new SyncPeersReport(syncPeerPool, Substitute.For <INodeStatsManager>(), NoErrorLimboLogs.Instance);

            report.WriteShortReport();
            report.WriteFullReport();

            syncPeer.IsInitialized.Returns(true);
            report.WriteShortReport();
            report.WriteFullReport();
        }
예제 #4
0
        public void Can_write_one_uninitialized_one_initialized()
        {
            ISyncPeerPool syncPeerPool = Substitute.For <ISyncPeerPool>();
            var           syncPeer     = BuildPeer(false);
            var           syncPeer2    = BuildPeer(true);

            var peers = new[] { syncPeer, syncPeer2 };

            syncPeerPool.PeerCount.Returns(peers.Length);

            SyncPeersReport report = new SyncPeersReport(syncPeerPool, Substitute.For <INodeStatsManager>(), NoErrorLimboLogs.Instance);

            report.WriteShortReport();
            report.WriteFullReport();
        }