Beispiel #1
0
 public void TransferFrom_Over_Token_Test()
 {
     Init_Test();
     Contract.Approve(AddressList[2], 500UL);
     SwitchOwner(AddressList[2]);
     Should.Throw <AssertionException>(() => { Contract.TransferFrom(AddressList[1], AddressList[2], 1000UL); });
 }
Beispiel #2
0
        public void Approve_Test()
        {
            Init_Test();
            Contract.Approve(AddressList[2], 1000UL);
            var allowance = Contract.Allowance(AddressList[1], AddressList[2]);

            allowance.ShouldBe(1000UL);
        }
Beispiel #3
0
        public void UnApprove_Available_Token_Test()
        {
            Init_Test();
            Contract.Approve(AddressList[2], 500UL);
            Contract.UnApprove(AddressList[2], 1000UL);
            var allowance = Contract.Allowance(AddressList[1], AddressList[2]);

            allowance.ShouldBe(0UL);
        }
Beispiel #4
0
        public void TransferFrom_MultipleTimes_Available_Token_Test()
        {
            Init_Test();
            Contract.Approve(AddressList[2], 1000UL);
            SwitchOwner(AddressList[2]);
            Contract.TransferFrom(AddressList[1], AddressList[2], 300UL);
            Contract.TransferFrom(AddressList[1], AddressList[2], 500UL);
            var balance2 = Contract.BalanceOf(AddressList[2]);

            balance2.ShouldBe(800UL);
        }
Beispiel #5
0
        public void TransferFrom_Available_Token_Test()
        {
            Init_Test();
            Contract.Approve(AddressList[2], 500UL);
            SwitchOwner(AddressList[2]);
            Contract.TransferFrom(AddressList[1], AddressList[2], 500UL);
            var balance1 = Contract.BalanceOf(AddressList[1]);
            var balance2 = Contract.BalanceOf(AddressList[2]);

            balance1.ShouldBe(Contract.TotalSupply() - 500UL);
            balance2.ShouldBe(500UL);
        }