Пример #1
0
        public BlocksRetriever(IConfiguration config, IRpcFactory rpc)
        {
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }

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

            this.config = config.GetZcoinSection();
            this.rpc    = rpc;
        }
Пример #2
0
        public TransfersControllerTests()
        {
            this.rpc = new Mock <IRpcFactory>();
            this.propertyManagementRpc = new Mock <IPropertyManagementRpc>();
            this.rawTransactionRpc     = new Mock <IRawTransactionRpc>();

            var anyCancellationToken = It.IsAny <CancellationToken>();

            this.rpc.Setup(f => f.CreatePropertyManagementRpcAsync(anyCancellationToken))
            .ReturnsAsync(this.propertyManagementRpc.Object);

            this.rpc.Setup(f => f.CreateRawTransactionRpcAsync(anyCancellationToken))
            .ReturnsAsync(this.rawTransactionRpc.Object);

            this.watcher            = new Mock <ITransactionConfirmationWatcher>();
            this.callbackRepository = new Mock <ICallbackRepository>();
            this.ruleRepository     = new Mock <IRuleRepository>();

            var builder = new ConfigurationBuilder();

            builder.AddInMemoryCollection(new System.Collections.Generic.Dictionary <string, string>
            {
                { "Api:Default:TransactionTimeout", "00:10" },
                { "Api:Default:RequiredConfirmation", "6" },
                { "Zcoin:Network:Type", "Mainnet" },
                { "Zcoin:Property:Id", "3" },
                { "Zcoin:Property:Type", "Divisible" },
                { "Zcoin:Property:Issuer", "Mainnet:a8ULhhDgfdSiXJhSZVdhb8EuDc6R3ogsaM" },
                { "Zcoin:Property:Distributor", "Mainnet:a8ULhhDgfdSiXJhSZVdhb8EuDc6R3ogsaM" },
            });

            this.configuration = builder.Build();
            this.zcoinConfig   = this.configuration.GetZcoinSection();
            this.apiConfig     = this.configuration.GetApiSection();

            this.helper = new ControllerHelper(this.callbackRepository.Object);

            this.subject = new TransfersController
                           (
                this.rpc.Object,
                this.watcher.Object,
                this.ruleRepository.Object,
                this.configuration,
                this.helper
                           );
        }
Пример #3
0
        public IssueTokenController(
            IRpcFactory factory,
            IConfiguration configuration,
            ITransactionConfirmationWatcher watcher,
            IRuleRepository ruleRepository,
            ControllerHelper helper)
        {
            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 (ruleRepository == null)
            {
                throw new ArgumentNullException(nameof(ruleRepository));
            }

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

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

            this.zcoinConfig = this.configuration.GetZcoinSection();
            this.apiConfig   = this.configuration.GetApiSection();
        }