Exemple #1
0
 public MempoolTests()
 {
     _hashProvider   = new HashProvider(HashingAlgorithm.GetAlgorithmMetadata("blake2b-256"));
     _memPool        = new Mempool(Substitute.For <IMempoolService <PublicEntryDao> >());
     _mapperProvider = new TestMapperProvider();
     _mempoolItem    = TransactionHelper
                       .GetPublicTransaction().PublicEntry
                       .ToDao <PublicEntry, PublicEntryDao>(_mapperProvider);
 }
Exemple #2
0
        public void Init()
        {
            _logger      = Substitute.For <ILogger>();
            _fakeContext = Substitute.For <IChannelHandlerContext>();
            var fakeChannel = Substitute.For <IChannel>();

            _fakeContext.Channel.Returns(fakeChannel);
            _fakeContext.Channel.RemoteAddress.Returns(new IPEndPoint(IPAddress.Loopback, IPEndPoint.MaxPort));
            _mapperProvider = new TestMapperProvider();
        }
Exemple #3
0
        private static List <PublicEntryDao> CreateTestTransactions()
        {
            var mapperProvider = new TestMapperProvider();
            var txLst          = new List <TransactionBroadcast>
            {
                TransactionHelper.GetPublicTransaction(234, "standardPubKey", "sign1"),
                TransactionHelper.GetPublicTransaction(567, "standardPubKey", "sign2")
            }.Select(x => x.PublicEntry.ToDao <PublicEntry, PublicEntryDao>(mapperProvider)).ToList();

            return(txLst);
        }
Exemple #4
0
        public TransactionReceivedEventTests()
        {
            var mapperProvider = new TestMapperProvider();

            _mempool = Substitute.For <IMempool <PublicEntryDao> >();
            _transactionValidator     = Substitute.For <ITransactionValidator>();
            _broadcastManager         = Substitute.For <IBroadcastManager>();
            _transactionReceivedEvent = new TransactionReceivedEvent(_transactionValidator,
                                                                     _mempool,
                                                                     _broadcastManager,
                                                                     mapperProvider,
                                                                     Substitute.For <ILogger>());
        }
        public DeltaTransactionRetrieverTests()
        {
            var mapperProvider = new TestMapperProvider();

            var random = new Random();

            var mempool = Substitute.For <IMempool <PublicEntryDao> >();

            _transactions = Enumerable.Range(0, 20).Select(i =>
                                                           TransactionHelper.GetPublicTransaction(
                                                               transactionFees: (ulong)random.Next(),
                                                               timestamp: random.Next(),
                                                               signature: i.ToString())
                                                           ).Select(x => x.PublicEntry).ToList();

            mempool.Service.GetAll()
            .Returns(_transactions.Select(x => x.ToDao <PublicEntry, PublicEntryDao>(mapperProvider)));

            _transactionRetriever = new DeltaTransactionRetriever(mempool, mapperProvider,
                                                                  TransactionComparerByPriceAndHash.Default);
        }
 public void Init()
 {
     _mapperProvider = new TestMapperProvider();
 }
Exemple #7
0
 public PeerRepositoryTests(ITestOutputHelper output) : base(output)
 {
     _mapperProvider = new TestMapperProvider();
 }