Пример #1
0
        protected RpcClientTesting(NodeConfigParameters?config = null)
        {
            this.nodeBuilder = NodeBuilderFactory.CreateNodeBuilder(GetType());

            try
            {
                this.nodeBuilder.ConfigParameters.Add("dandelion", "0");
                this.nodeBuilder.ConfigParameters.Add("elysium", "1");

                if (config != null)
                {
                    this.nodeBuilder.ConfigParameters.Import(config, true);
                }

                this.Node    = this.nodeBuilder.CreateNode(true);
                this.Client  = this.Node.CreateRPCClient();
                this.Factory = new RpcClientFactory(
                    this.nodeBuilder.Network,
                    this.Node.RPCUri,
                    RPCCredentialString.Parse(this.Node.GetRPCAuth()),
                    new TransactionSerializer(ElysiumSerializers));

                this.subject = new Lazy <T>(CreateSubject);
            }
            catch
            {
                this.nodeBuilder.Dispose();
                throw;
            }
        }
Пример #2
0
        protected RpcClientTesting()
        {
            this.nodes = NodeBuilderFactory.CreateNodeBuilder(GetType());

            try
            {
                this.nodes.ConfigParameters.Add("autocommit", "0");
                this.nodes.ConfigParameters.Add("dandelion", "0");
                this.nodes.ConfigParameters.Add("exodus", "1");

                Node   = this.nodes.CreateNode(true);
                Client = Node.CreateRPCClient();

                Factory = new RpcFactory(
                    this.nodes.Network,
                    Node.RPCUri,
                    RPCCredentialString.Parse(Node.GetRPCAuth()),
                    new TransactionEncoder(ExodusEncoders)
                    );

                this.subject = new Lazy <RpcClient>(CreateSubject, LazyThreadSafetyMode.ExecutionAndPublication); // lgtm[cs/virtual-call-in-constructor]
            }
            catch
            {
                this.nodes.Dispose();
                throw;
            }
        }
Пример #3
0
        public RpcFactoryTests()
        {
            this.nodes = NodeBuilderFactory.CreateNodeBuilder(GetType());

            try
            {
                var node = this.nodes.CreateNode(true);

                this.network       = node.Network;
                this.server        = node.RPCUri;
                this.credential    = RPCCredentialString.Parse(node.GetRPCAuth());
                this.exodusEncoder = new Mock <ITransactionEncoder>();
                this.subject       = new RpcFactory(this.network, this.server, this.credential, this.exodusEncoder.Object);
            }
            catch
            {
                this.nodes.Dispose();
                throw;
            }
        }
Пример #4
0
 public RpcTests()
 {
     this.builder = NodeBuilderFactory.CreateNodeBuilder(GetType());
     this.node    = this.builder.CreateNode(true);
     this.rpc     = node.CreateRPCClient();
 }