예제 #1
0
        public void TransferDoubleOwnerBalanceToRecipient()
        {
            var amount = new SimpleParameter(0);


            var fromStartingBalance = _contract.InvokeLocalMethod <BigInteger>("balanceOf", _ownerParameter);
            var toStartingBalance   = _contract.InvokeLocalMethod <BigInteger>("balanceOf", _nonOwnerParameter);


            amount.Value = fromStartingBalance * 2; //way over what the sender has in their posession


            var messages = _contract.InvokeBlockchainMethod("transfer", _ownerParameter, _nonOwnerParameter, amount);

            //ensure the transfer event was not fired
            if (messages.FindMessagesThatStartWith("transfer").Count != 0)
            {
                Assert.Fail("Transfer event should not have fired but it did");
            }


            var fromPostTransferBalance = _contract.InvokeLocalMethod <BigInteger>("balanceOf", _ownerParameter);
            var toPostTransferBalance   = _contract.InvokeLocalMethod <BigInteger>("balanceOf", _nonOwnerParameter);

            Assert.AreEqual(fromStartingBalance, fromPostTransferBalance, "From balance");
            Assert.AreEqual(toStartingBalance, toPostTransferBalance, "To balance");
        }
예제 #2
0
 public void Deploy()
 {
     _contract.InvokeBlockchainMethod("deploy");
 }