Пример #1
0
        public async Task ShouldPassCyprusCallTest()
        {
            string  error;
            Address coinbase;
            long    number;
            H256    hash;
            ulong?  balance, nonce;
            JObject block, block1;
            int     count;

            // cyprus_coinbase
            (coinbase, error) = await cyprus.GetCoinbaseAsync();

            Assert.True(string.IsNullOrEmpty(error));
            Assert.False(string.IsNullOrEmpty(coinbase));

            // cyprus_blockNumber
            (number, error) = await cyprus.GetBlockNumberAsync();

            Assert.True(string.IsNullOrEmpty(error));

            // cyprus_getBalance ( earliest )
            (balance, error) = await cyprus.GetBalanceAsync(coinbase, CyprusHelper.EARLIEST);

            Assert.True(string.IsNullOrEmpty(error));
            Assert.NotNull(balance);

            // cyprus_getBalance ( latest )
            (balance, error) = await cyprus.GetBalanceAsync(coinbase, CyprusHelper.LATEST);

            Assert.True(string.IsNullOrEmpty(error));
            Assert.NotNull(balance);

            // cyprus_getBalance ( pending )
            (balance, error) = await cyprus.GetBalanceAsync(coinbase, CyprusHelper.PENDING);

            Assert.True(string.IsNullOrEmpty(error));
            Assert.NotNull(balance);

            // cyprus_getBalance ( number )
            (balance, error) = await cyprus.GetBalanceAsync(coinbase, Hex.ToString(number, true));

            Assert.True(string.IsNullOrEmpty(error));
            Assert.NotNull(balance);

            // cyprus_getTransactionCount ( earliest )
            (nonce, error) = await cyprus.GetTransactionCountAsync(coinbase, CyprusHelper.EARLIEST);

            Assert.True(string.IsNullOrEmpty(error));
            Assert.NotNull(nonce);

            // cyprus_getTransactionCount ( latest )
            (nonce, error) = await cyprus.GetTransactionCountAsync(coinbase, CyprusHelper.LATEST);

            Assert.True(string.IsNullOrEmpty(error));
            Assert.NotNull(nonce);

            // cyprus_getTransactionCount ( pending )
            (nonce, error) = await cyprus.GetTransactionCountAsync(coinbase, CyprusHelper.PENDING);

            Assert.True(string.IsNullOrEmpty(error));
            Assert.NotNull(nonce);

            // cyprus_getBalance ( number )
            (nonce, error) = await cyprus.GetTransactionCountAsync(coinbase, Hex.ToString(number, true));

            Assert.True(string.IsNullOrEmpty(error));
            Assert.NotNull(nonce);

            // cyprus_getBlockByNumber / cyprus_getBlockByHash
            (block, error) = await cyprus.GetBlockByNumberAsync(number, true);

            Assert.True(string.IsNullOrEmpty(error));

            hash = block.Value <string>("hash");

            (block1, error) = await cyprus.GetBlockByHashAsync(block.Value <string>("hash"), true);

            Assert.True(string.IsNullOrEmpty(error));
            Assert.Equal(block.Value <string>("hash"), block1.Value <string>("hash"));

            // cyprus_getBlockTransactionCountByHash
            (count, error) = await cyprus.GetBlockTransactionCountByHashAsync(hash);

            Assert.True(string.IsNullOrEmpty(error));
            Assert.True(count >= 0);

            // cyprus_getBlockTransactionCountByNumber
            (count, error) = await cyprus.GetBlockTransactionCountByNumberAsync(number);

            Assert.True(string.IsNullOrEmpty(error));
            Assert.True(count >= 0);
        }