diff --git a/tests/neo.UnitTests/SmartContract/UT_InteropService.cs b/tests/neo.UnitTests/SmartContract/UT_InteropService.cs index 399f063ec7..20df416778 100644 --- a/tests/neo.UnitTests/SmartContract/UT_InteropService.cs +++ b/tests/neo.UnitTests/SmartContract/UT_InteropService.cs @@ -52,11 +52,17 @@ public void Runtime_GetNotifications_Test() scriptHash2 = script.ToArray().ToScriptHash(); snapshot.Contracts.Delete(scriptHash2); - snapshot.Contracts.Add(scriptHash2, new ContractState() + var state = new ContractState() { Script = script.ToArray(), Manifest = TestUtils.CreateDefaultManifest(scriptHash2, "test"), - }); + }; + state.Manifest.Abi.Methods[0].Parameters = new ContractParameterDefinition[] + { + new ContractParameterDefinition(){ Name="a", Type= ContractParameterType.Integer}, + new ContractParameterDefinition(){ Name="b", Type= ContractParameterType.Integer} + }; + snapshot.Contracts.Add(scriptHash2, state); } // Wrong length @@ -217,8 +223,6 @@ public void TestExecutionEngine_GetCallingScriptHash() // Test real using ScriptBuilder scriptA = new ScriptBuilder(); - scriptA.Emit(OpCode.DROP); // Drop arguments - scriptA.Emit(OpCode.DROP); // Drop method scriptA.EmitSysCall(ApplicationEngine.System_Runtime_GetCallingScriptHash); var contract = new ContractState() @@ -230,7 +234,7 @@ public void TestExecutionEngine_GetCallingScriptHash() engine.Snapshot.Contracts.Add(contract.ScriptHash, contract); using ScriptBuilder scriptB = new ScriptBuilder(); - scriptB.EmitAppCall(contract.ScriptHash, "test", 0, 1); + scriptB.EmitAppCall(contract.ScriptHash, "test"); engine.LoadScript(scriptB.ToArray()); Assert.AreEqual(VMState.HALT, engine.Execute()); @@ -601,6 +605,11 @@ public void TestContract_Call() { var snapshot = Blockchain.Singleton.GetSnapshot(); var state = TestUtils.GetContract("method"); + state.Manifest.Abi.Methods[0].Parameters = new ContractParameterDefinition[] + { + new ContractParameterDefinition(){ Name="a", Type= ContractParameterType.Integer}, + new ContractParameterDefinition(){ Name="b", Type= ContractParameterType.Integer} + }; state.Manifest.Features = ContractFeatures.HasStorage; string method = "method"; var args = new VM.Types.Array { 0, 1 }; @@ -628,6 +637,11 @@ public void TestContract_CallEx() var snapshot = Blockchain.Singleton.GetSnapshot(); var state = TestUtils.GetContract("method"); + state.Manifest.Abi.Methods[0].Parameters = new ContractParameterDefinition[] + { + new ContractParameterDefinition(){ Name="a", Type= ContractParameterType.Integer}, + new ContractParameterDefinition(){ Name="b", Type= ContractParameterType.Integer} + }; state.Manifest.Features = ContractFeatures.HasStorage; snapshot.Contracts.Add(state.ScriptHash, state); diff --git a/tests/neo.UnitTests/SmartContract/UT_Syscalls.cs b/tests/neo.UnitTests/SmartContract/UT_Syscalls.cs index 848079aef3..1590682742 100644 --- a/tests/neo.UnitTests/SmartContract/UT_Syscalls.cs +++ b/tests/neo.UnitTests/SmartContract/UT_Syscalls.cs @@ -345,6 +345,14 @@ public void System_Runtime_GetInvocationCounter() contracts.Add(contractA.ScriptHash, contractA); contracts.Add(contractB.ScriptHash, contractB); contracts.Add(contractC.ScriptHash, contractC); + + contractA.Manifest.Abi.Methods[0].Parameters = + contractB.Manifest.Abi.Methods[0].Parameters = + contractC.Manifest.Abi.Methods[0].Parameters = new Neo.SmartContract.Manifest.ContractParameterDefinition[] + { + new Neo.SmartContract.Manifest.ContractParameterDefinition(){ Name="a", Type= ContractParameterType.Integer}, + new Neo.SmartContract.Manifest.ContractParameterDefinition(){ Name="b", Type= ContractParameterType.Integer} + }; } // Call A,B,B,C diff --git a/tests/neo.UnitTests/TestUtils.cs b/tests/neo.UnitTests/TestUtils.cs index fd8e6fd620..c621bb6747 100644 --- a/tests/neo.UnitTests/TestUtils.cs +++ b/tests/neo.UnitTests/TestUtils.cs @@ -25,19 +25,19 @@ public static ContractManifest CreateDefaultManifest(UInt160 hash, string method Abi = new ContractAbi() { Hash = hash, - Events = new ContractEventDescriptor[0], - Methods = method == null ? new ContractMethodDescriptor[0] : new ContractMethodDescriptor[] + Events = Array.Empty(), + Methods = method == null ? Array.Empty() : new ContractMethodDescriptor[] { new ContractMethodDescriptor() { Name = method, - Parameters = new ContractParameterDefinition[0], + Parameters = Array.Empty(), ReturnType = ContractParameterType.Integer } } }, Features = ContractFeatures.NoProperty, - Groups = new ContractGroup[0], + Groups = Array.Empty(), SafeMethods = WildcardContainer.Create(), Trusts = WildcardContainer.Create(), Extra = null,