Пример #1
0
        public async Task ShouldGetTheCorrectBalanceAfterSetUserBalance()
        {
            var contractDeploymentDefault = new NatCoinDeployment()
            {
                FromAddress = DefaultTestAccountConstants.Address,
            };

            GivenADeployedContract(contractDeploymentDefault);

            var createUserNatCoinsMessage = new CreateUserNatCoinsFunction()
            {
                FromAddress = DefaultTestAccountConstants.Address,
                Login       = "******",
                Email       = "*****@*****.**",
                Id          = 1,
                Natcoin     = 54
            };

            var createUserNatCoinsMessage2 = new CreateUserNatCoinsFunction()
            {
                FromAddress = DefaultTestAccountConstants.Address,
                Login       = "******",
                Email       = "*****@*****.**",
                Id          = 2,
                Natcoin     = 544
            };
            var receipt1 = GivenATransaction(createUserNatCoinsMessage);
            var receipt2 = GivenATransaction(createUserNatCoinsMessage2);

            WhenQuerying <GetUserBalanceFunction, GetUserBalanceOutputDTO>(new GetUserBalanceFunction()
            {
                Id = 1
            })
            .ThenExpectResult(
                new GetUserBalanceOutputDTO()
            {
                B = 54
            });
        }
Пример #2
0
        public static async Task <NatCoinService> DeployContractAndGetServiceAsync(Nethereum.Web3.Web3 web3, NatCoinDeployment natCoinDeployment, CancellationTokenSource cancellationTokenSource = null)
        {
            var receipt = await DeployContractAndWaitForReceiptAsync(web3, natCoinDeployment, cancellationTokenSource);

            return(new NatCoinService(web3, receipt.ContractAddress));
        }
Пример #3
0
 public static Task <string> DeployContractAsync(Nethereum.Web3.Web3 web3, NatCoinDeployment natCoinDeployment)
 {
     return(web3.Eth.GetContractDeploymentHandler <NatCoinDeployment>().SendRequestAsync(natCoinDeployment));
 }
Пример #4
0
 public static Task <TransactionReceipt> DeployContractAndWaitForReceiptAsync(Nethereum.Web3.Web3 web3, NatCoinDeployment natCoinDeployment, CancellationTokenSource cancellationTokenSource = null)
 {
     return(web3.Eth.GetContractDeploymentHandler <NatCoinDeployment>().SendRequestAndWaitForReceiptAsync(natCoinDeployment, cancellationTokenSource));
 }