Пример #1
0
        public void should_notify_added_peer_of_own_tx()
        {
            _txPool = CreatePool(_noTxStorage);
            var         tx         = AddOwnTransactionToPool().First();
            ITxPoolPeer txPoolPeer = Substitute.For <ITxPoolPeer>();

            txPoolPeer.Id.Returns(TestItem.PublicKeyA);
            _txPool.AddPeer(txPoolPeer);
            txPoolPeer.Received().SendNewTransaction(tx, false);
        }
Пример #2
0
        public async Task should_notify_peer_only_once()
        {
            _txPool = CreatePool(_noTxStorage);
            ITxPoolPeer txPoolPeer = Substitute.For <ITxPoolPeer>();

            txPoolPeer.Id.Returns(TestItem.PublicKeyA);
            _txPool.AddPeer(txPoolPeer);
            var tx = AddOwnTransactionToPool().First();
            await Task.Delay(1000);

            txPoolPeer.Received(1).SendNewTransaction(tx, true);
        }