public void OnNextCore_WhenTransactionsMissingInLongestChain_ReturnsThemToTheMempool() { var mempoolValidatorMock = new Mock <IMempoolValidator>(); var mempoolMock = new Mock <ITxMempool>(); var loggerFactoryMock = new Mock <ILoggerFactory>(); loggerFactoryMock.Setup(i => i.CreateLogger(It.IsAny <string>())).Returns(new Mock <ILogger>().Object); Signals.Signals signals = new Signals.Signals(loggerFactoryMock.Object, null); var subject = new BlocksDisconnectedSignaled(mempoolMock.Object, mempoolValidatorMock.Object, new MempoolSchedulerLock(), loggerFactoryMock.Object, signals); subject.Initialize(); var block = new Block(); var genesisChainedHeaderBlock = new ChainedHeaderBlock(block, ChainedHeadersHelper.CreateGenesisChainedHeader()); var transaction1 = new Transaction(); var transaction2 = new Transaction(); block.Transactions = new List <Transaction> { transaction1, transaction2 }; signals.Publish(new BlockDisconnected(genesisChainedHeaderBlock)); mempoolValidatorMock.Verify(x => x.AcceptToMemoryPool(It.IsAny <MempoolValidationState>(), transaction1)); mempoolValidatorMock.Verify(x => x.AcceptToMemoryPool(It.IsAny <MempoolValidationState>(), transaction2)); }
public void OnNextCore_WhenTransactionsMissingInLongestChain_ReturnsThemToTheMempool() { var mempoolValidatorMock = new Mock <IMempoolValidator>(); var loggerFactoryMock = new Mock <ILoggerFactory>(); loggerFactoryMock.Setup(i => i.CreateLogger(It.IsAny <string>())).Returns(new Mock <ILogger>().Object); var subject = new BlocksDisconnectedSignaled(mempoolValidatorMock.Object, new MempoolSchedulerLock(), loggerFactoryMock.Object); var block = new Block(); var transaction1 = new Transaction(); var transaction2 = new Transaction(); block.Transactions = new List <Transaction> { transaction1, transaction2 }; subject.OnNext(block); mempoolValidatorMock.Verify(x => x.AcceptToMemoryPool(It.IsAny <MempoolValidationState>(), transaction1)); mempoolValidatorMock.Verify(x => x.AcceptToMemoryPool(It.IsAny <MempoolValidationState>(), transaction2)); }