public void TestOnPersistWithArgs() { var snapshot = Blockchain.Singleton.GetSnapshot(); ApplicationEngine engine1 = ApplicationEngine.Create(TriggerType.Application, null, snapshot, 0); Assert.ThrowsException <InvalidOperationException>(() => testNativeContract.TestOnPersist(engine1)); ApplicationEngine engine2 = ApplicationEngine.Create(TriggerType.OnPersist, null, snapshot, 0); testNativeContract.TestOnPersist(engine2); }
public void TestOnPersistWithArgs() { var snapshot = Blockchain.Singleton.GetSnapshot(); ApplicationEngine engine1 = new ApplicationEngine(TriggerType.Application, null, snapshot, 0); VMArray args = new VMArray(); VM.Types.Boolean result1 = new VM.Types.Boolean(false); testNativeContract.TestOnPersist(engine1, args).Should().Be(result1); ApplicationEngine engine2 = new ApplicationEngine(TriggerType.System, null, snapshot, 0); VM.Types.Boolean result2 = new VM.Types.Boolean(true); testNativeContract.TestOnPersist(engine2, args).Should().Be(result2); }
public void TestOnPersistWithArgs() { ApplicationEngine engine1 = new ApplicationEngine(TriggerType.Application, null, Store.GetSnapshot(), 0); TestNativeContract testNativeContract = new TestNativeContract(); VMArray args = new VMArray(); VM.Types.Boolean result1 = new VM.Types.Boolean(false); testNativeContract.TestOnPersist(engine1, args).Should().Be(result1); ApplicationEngine engine2 = new ApplicationEngine(TriggerType.System, null, Store.GetSnapshot(), 0); VM.Types.Boolean result2 = new VM.Types.Boolean(true); testNativeContract.TestOnPersist(engine2, args).Should().Be(result2); }