public void TestContract_Call() { var snapshot = Blockchain.Singleton.GetSnapshot(); string method = "method"; var args = new VM.Types.Array { 0, 1 }; var state = TestUtils.GetContract(method, args.Count); state.Manifest.Features = ContractFeatures.HasStorage; snapshot.Contracts.Add(state.ScriptHash, state); var engine = new ApplicationEngine(TriggerType.Application, null, snapshot, 0, true); engine.LoadScript(new byte[] { 0x01 }); engine.CallContract(state.ScriptHash, method, args); engine.CurrentContext.EvaluationStack.Pop().Should().Be(args[0]); engine.CurrentContext.EvaluationStack.Pop().Should().Be(args[1]); state.Manifest.Permissions[0].Methods = WildcardContainer <string> .Create("a"); Assert.ThrowsException <InvalidOperationException>(() => engine.CallContract(state.ScriptHash, method, args)); state.Manifest.Permissions[0].Methods = WildcardContainer <string> .CreateWildcard(); engine.CallContract(state.ScriptHash, method, args); Assert.ThrowsException <InvalidOperationException>(() => engine.CallContract(UInt160.Zero, method, args)); }