Example #1
0
        public void TestPrepareGLBatchForPostingArgumentValidation()
        {
            TVerificationResultCollection VerificationResult = null;
            TDBTransaction Transaction = null;
            GLBatchTDS     MainDS      = null;
            int            BatchPeriod = -1;

            string Message = "Validation failed for PrepareGLBatchForPosting with ledger number less than 1.";

            // Prepare GL Batch For Posting with ledger number less than 1
            try
            {
                TGLPosting.PrepareGLBatchForPosting(out MainDS, -1, 1, ref Transaction, out VerificationResult, null, ref BatchPeriod);
                Assert.Fail(Message);
            }
            catch (EFinanceSystemInvalidLedgerNumberException e)
            {
                Assert.AreEqual(-1, e.LedgerNumber, Message);
            }
            catch
            {
                Assert.Fail(Message);
            }

            Message = "Validation failed for PrepareGLBatchForPosting with batch number less than 1.";

            // Prepare GL Batch For Posting with batch number less than 1
            try
            {
                TGLPosting.PrepareGLBatchForPosting(out MainDS, 1, -1, ref Transaction, out VerificationResult, null, ref BatchPeriod);
                Assert.Fail(Message);
            }
            catch (EFinanceSystemInvalidBatchNumberException e)
            {
                Assert.AreEqual(1, e.LedgerNumber, Message);
                Assert.AreEqual(-1, e.BatchNumber, Message);
            }
            catch
            {
                Assert.Fail(Message);
            }

            Message = "Validation failed for PrepareGLBatchForPosting with null transaction.";

            // Prepare GL Batch For Posting with null transaction
            try
            {
                TGLPosting.PrepareGLBatchForPosting(out MainDS, 1, 1, ref Transaction, out VerificationResult, null, ref BatchPeriod);
                Assert.Fail(Message);
            }
            catch (EFinanceSystemDBTransactionNullException e)
            {
                Assert.AreEqual("Function:Prepare GL Batch For Posting - Database Transaction must not be NULL!", e.Message,
                                Message);
            }
            catch
            {
                Assert.Fail(Message);
            }
        }
Example #2
0
        public void TestPrepareGLBatchForPostingArgumentValidation()
        {
            TVerificationResultCollection VerificationResult = new TVerificationResultCollection();
            TDataBase      db          = DBAccess.Connect("TestPrepareGLBatchForPostingArgumentValidation");
            TDBTransaction Transaction = db.BeginTransaction(IsolationLevel.ReadCommitted);
            GLBatchTDS     MainDS      = null;
            int            BatchPeriod = -1;

            string Message = "Validation failed for PrepareGLBatchForPosting with ledger number less than 1.";

            // Prepare GL Batch For Posting with ledger number less than 1
            try
            {
                TGLPosting.PrepareGLBatchForPosting(out MainDS, -1, 1, ref Transaction, out VerificationResult, null, ref BatchPeriod);
                Assert.Fail(Message);
            }
            catch (EFinanceSystemInvalidLedgerNumberException e)
            {
                Assert.AreEqual(-1, e.LedgerNumber, Message);
            }
            catch
            {
                Assert.Fail(Message);
            }

            // Prepare GL Batch For Posting with batch number less than 1
            Message = "Validation failed for PrepareGLBatchForPosting with batch number less than 1.";
            try
            {
                TGLPosting.PrepareGLBatchForPosting(out MainDS, 43, -1, ref Transaction, out VerificationResult, null, ref BatchPeriod);
                Assert.Fail(Message);
            }
            catch (EFinanceSystemInvalidBatchNumberException e)
            {
                Assert.AreEqual(43, e.LedgerNumber, Message);
                Assert.AreEqual(-1, e.BatchNumber, Message);
            }
            catch
            {
                Assert.Fail(Message);
            }
        }