Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }