Exemple #1
0
        public void T23()
        {
            var tran = new LockTransaction("Testing 101", "A", 0, 0.0d,
                                           LockOp.If(
                                               LockOp.True,//condition
                                               LockOp.SelectConstantValue("A", "THEN"),
                                               LockOp.SelectConstantValue("A", "ELZE")
                                               ),

                                           LockOp.If(
                                               LockOp.False,//condition
                                               LockOp.SelectConstantValue("B", "THEN"),
                                               LockOp.SelectConstantValue("B", "ELZE")
                                               ),

                                           LockOp.If(
                                               LockOp.False,//condition
                                               LockOp.SelectConstantValue("C", "THEN")
                                               )
                                           );

            var session = new Agni.Locking.Server.LockSessionData(new LockSessionID(null), "My session", 1000);

            var result = m_Server.ExecuteLockTransaction(session, tran);

            Aver.IsTrue(LockStatus.TransactionOK == result.Status);

            Aver.AreEqual("THEN", result["A"].AsString());
            Aver.AreEqual("ELZE", result["B"].AsString());
            Aver.IsNull(result["C"]);
        }
Exemple #2
0
        public void T22()
        {
            var tran = new LockTransaction("Testing 101", "A", 0, 0.0d,
                                           LockOp.SelectConstantValue("A", "YES"),
                                           LockOp.SelectConstantValue("B", 123),
                                           LockOp.SelectConstantValue("C", true)
                                           );

            var session = new Agni.Locking.Server.LockSessionData(new LockSessionID(null), "My session", 1000);

            var result = m_Server.ExecuteLockTransaction(session, tran);

            Aver.IsTrue(LockStatus.TransactionOK == result.Status);


            Aver.AreEqual("YES", result["A"].AsString());
            Aver.AreEqual(123, result["B"].AsInt());
            Aver.IsTrue(result["C"].AsBool());
        }
Exemple #3
0
        public void T24()
        {
            var tran = new LockTransaction("Testing 101", "A", 0, 0.0d,
                                           LockOp.Block(
                                               LockOp.SelectConstantValue("A", 123),
                                               LockOp.If(
                                                   LockOp.False,//condition
                                                   LockOp.SelectConstantValue("B", "THEN"),
                                                   LockOp.Abort()
                                                   )//if
                                               )
                                           );

            var session = new Agni.Locking.Server.LockSessionData(new LockSessionID(null), "My session", 1000);

            var result = m_Server.ExecuteLockTransaction(session, tran);

            Aver.IsTrue(LockStatus.TransactionError == result.Status);
            Aver.IsTrue(LockErrorCause.Statement == result.ErrorCause);
            Aver.AreEqual("0:/BlockOp/IfOp/AbortOp/", result.FailedStatement);
        }