Exemple #1
0
        public async Task DeploymentException()
        {
            ContractExecutionException exec = null;

            try
            {
                await ExceptionContract.New(_throwOnConstructor : true, RpcClient);
            }
            catch (ContractExecutionException ex)
            {
                exec = ex;
            }

            var expected = @"
INVALID instruction hit!
-> at 'assert(!_throwOnConstructor);' in 'ExceptionContract' constructor in file 'ExceptionContract.sol' : line 8";

            Assert.AreEqual(
                StringUtil.NormalizeNewLines(expected).Trim(),
                StringUtil.NormalizeNewLines(exec.Message).Trim());
        }
 public async Task ExpectDeploymentRevert_Fail()
 {
     await Assert.ThrowsExceptionAsync <Exception>(() => ExceptionContract.New(_throwOnConstructor : false, RpcClient).ExpectRevert());
 }
Exemple #3
0
 protected override async Task BeforeEach()
 {
     // Deploy our test contract
     _contract = await ExceptionContract.New(_throwOnConstructor : false, RpcClient);
 }
 public async Task ExpectDeploymentRevert()
 {
     await ExceptionContract.New(_throwOnConstructor : true, RpcClient).ExpectRevert();
 }