public TransactionConfirmationWatcherTests()
        {
            this.callbackRepository = Substitute.For <ICallbackRepository>();
            this.ruleRepository     = Substitute.ForPartsOf <FakeRuleRepository>();

            this.blockStorage = Substitute.For <IBlocksStorage>();
            this.blockStorage
            .GetAsync(Arg.Any <uint256>(), Arg.Any <CancellationToken>())
            .Returns(info => mockedBlocks[info.ArgAt <uint256>(0)].ToValueTuple());

            this.callbackExecuter = Substitute.For <ICallbackExecuter>();
            this.logger           = Substitute.For <ILogger <TransactionConfirmationWatcher> >();
            this.watchRepository  = new FakeWatchRepository();

            this.handler = this.subject = new TransactionConfirmationWatcher
                                          (
                this.callbackRepository,
                this.ruleRepository,
                this.blockStorage,
                this.callbackExecuter,
                this.watchRepository,
                this.logger
                                          );
            this.blockListener = this.subject;
            this.defaultUrl    = new Uri("http://zcoin.io");

            MockCallbackRepository();
        }
Exemplo n.º 2
0
        public ControllerHelper(
            ICallbackRepository callbackRepository)
        {
            if (callbackRepository == null)
            {
                throw new ArgumentNullException(nameof(callbackRepository));
            }

            this.callbackRepository = callbackRepository;
        }
Exemplo n.º 3
0
        public TransactionConfirmationWatcher(
            ICallbackRepository callbackRepository,
            IRuleRepository ruleRepository,
            IBlocksStorage blocks,
            ICallbackExecuter callbackExecuter,
            IWatchRepository watchRepository,
            ILogger <TransactionConfirmationWatcher> logger)
        {
            if (callbackRepository == null)
            {
                throw new ArgumentNullException(nameof(callbackRepository));
            }

            if (ruleRepository == null)
            {
                throw new ArgumentNullException(nameof(ruleRepository));
            }

            if (blocks == null)
            {
                throw new ArgumentNullException(nameof(blocks));
            }

            if (callbackExecuter == null)
            {
                throw new ArgumentNullException(nameof(callbackExecuter));
            }

            if (watchRepository == null)
            {
                throw new ArgumentNullException(nameof(watchRepository));
            }

            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            this.callbackRepository = callbackRepository;
            this.ruleRepository     = ruleRepository;
            this.watchRepository    = watchRepository;
            this.callbackExecuter   = callbackExecuter;
            this.logger             = logger;

            this.watcher = new Zcoin.Watching.TransactionConfirmationWatcher <Rule>
                           (
                this,
                blocks
                           );

            this.timers    = new Dictionary <uint256, Dictionary <Guid, Timer> >();
            this.timerLock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion);
        }
            public WatchArgsBuilder(ICallbackRepository callbackRepository)
            {
                this.CallbackRepository = callbackRepository;

                this.Transaction       = uint256.Parse("7396ddaa275ed5492564277efc0844b4aeaa098020bc8d4b4dbc489134e49afd");
                this.Confirmations     = 10;
                this.Timeout           = TimeSpan.FromSeconds(1);
                this.Ip                = IPAddress.Loopback;
                this.CallbackUrl       = new Uri("http://zcoin.io");
                this.SuccessData       = new CallbackResult(CallbackResult.StatusSuccess, "success");
                this.TimeoutData       = new CallbackResult(CallbackResult.StatusError, "timeout");
                this.CancellationToken = CancellationToken.None;
            }
Exemplo n.º 5
0
 public HomeController(IMapper mapper,
                       IBannerRepository bannerRepository,
                       IManufacturerRepository manufacturerRepository,
                       INewsItemRepository newsItemRepository,
                       ICallbackRepository callbackRepository,
                       IUnitOfWork unitOfWork)
 {
     _mapper                 = mapper;
     _bannerRepository       = bannerRepository;
     _manufacturerRepository = manufacturerRepository;
     _newsItemRepository     = newsItemRepository;
     _callbackRepository     = callbackRepository;
     _unitOfWork             = unitOfWork;
 }
Exemplo n.º 6
0
        public IssueTokenController(
            IRpcFactory factory,
            IConfiguration configuration,
            ITransactionConfirmationWatcher watcher,
            ICallbackRepository callbackRepository,
            IRuleRepository ruleRepository)
        {
            if (factory == null)
            {
                throw new ArgumentNullException(nameof(factory));
            }

            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            if (watcher == null)
            {
                throw new ArgumentNullException(nameof(watcher));
            }

            if (callbackRepository == null)
            {
                throw new ArgumentNullException(nameof(callbackRepository));
            }

            if (ruleRepository == null)
            {
                throw new ArgumentNullException(nameof(ruleRepository));
            }

            this.factory            = factory;
            this.configuration      = configuration;
            this.watcher            = watcher;
            this.callbackRepository = callbackRepository;
            this.ruleRepository     = ruleRepository;

            this.zcoinConfig = this.configuration.GetZcoinSection();
            this.apiConfig   = this.configuration.GetApiSection();
        }
Exemplo n.º 7
0
        public EntityRuleRepository(
            IMainDatabaseFactory db,
            ICallbackRepository callbacks,
            IReceivingAddressRepository addresses)
        {
            if (db == null)
            {
                throw new ArgumentNullException(nameof(db));
            }

            if (callbacks == null)
            {
                throw new ArgumentNullException(nameof(callbacks));
            }

            if (addresses == null)
            {
                throw new ArgumentNullException(nameof(addresses));
            }

            this.db        = db;
            this.callbacks = callbacks;
            this.addresses = addresses;
        }
Exemplo n.º 8
0
 public HomeController(ICallbackRepository callbackRepository)
 {
     this.callbackRepository = callbackRepository;
 }
Exemplo n.º 9
0
 public AdminController(IDataImporter dataImporter, ICallbackRepository callbackRepository)
 {
     this.dataImporter = dataImporter;
     this.callbackRepository = callbackRepository;
 }
Exemplo n.º 10
0
        public TokenReceivingWatcher(
            PropertyId property,
            ILogger <TokenReceivingWatcher> logger,
            IBlocksStorage blocks,
            IReceivingAddressPool addressPool,
            ITransactionRetriever exodusRetriever,
            IRuleRepository rules,
            IWatchRepository watches,
            ICallbackRepository callbacks,
            ICallbackExecuter callbackExecutor,
            ITimerScheduler timerScheduler)
        {
            if (property == null)
            {
                throw new ArgumentNullException(nameof(property));
            }

            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            if (addressPool == null)
            {
                throw new ArgumentNullException(nameof(addressPool));
            }

            if (exodusRetriever == null)
            {
                throw new ArgumentNullException(nameof(exodusRetriever));
            }

            if (rules == null)
            {
                throw new ArgumentNullException(nameof(rules));
            }

            if (watches == null)
            {
                throw new ArgumentNullException(nameof(watches));
            }

            if (callbacks == null)
            {
                throw new ArgumentNullException(nameof(callbacks));
            }

            if (callbackExecutor == null)
            {
                throw new ArgumentNullException(nameof(callbackExecutor));
            }

            if (timerScheduler == null)
            {
                throw new ArgumentNullException(nameof(timerScheduler));
            }

            this.property         = property;
            this.logger           = logger;
            this.addressPool      = addressPool;
            this.exodusRetriever  = exodusRetriever;
            this.rules            = rules;
            this.watches          = watches;
            this.callbacks        = callbacks;
            this.callbackExecutor = callbackExecutor;
            this.timerScheduler   = timerScheduler;
            this.watchings        = new Dictionary <BitcoinAddress, Watching>();
            this.engine           = new BalanceWatcher <Rule, PropertyAmount>(this, blocks);
            this.semaphore        = new SemaphoreSlim(1, 1);
            this.stopped          = true;
        }
Exemplo n.º 11
0
 public HomeController(ICallbackRepository callbackRepository)
 {
     this.callbackRepository = callbackRepository;
 }
Exemplo n.º 12
0
 public AdminController(IDataImporter dataImporter, ICallbackRepository callbackRepository)
 {
     this.dataImporter       = dataImporter;
     this.callbackRepository = callbackRepository;
 }