コード例 #1
0
        ///<summary>
        ///Purpose   : Purge data from db
        ///Procedure : 1. Directly call QuotationHandler.DeleteQuotation from test class.
        ///            2. Check return result of the process and remaining data in DB.
        ///            Change locked table - tbt_QuotationSentryGuardDetails
        ///Expected  : 1. dtBatchProcessResult (7 cases following locked tables)
        ///                .Result  = 0
        ///                .BatchStatus = NULL
        ///                .Total  = 13
        ///                .Complete = 0
        ///                .Failed  = 13
        ///                .ErrorMessage = Delete quotation process is failed. Cannot delete tbt_QuotationSentryGuardDetails. All deleted data is rollbacked.
        ///            2. Expected data in db
        ////                - Not change from before running the process
        ///</summary>
        public string Case2()
        {
            IQuotationHandler    target   = ServiceContainer.GetService <IQuotationHandler>() as IQuotationHandler;
            dtBatchProcessResult expected = CreateExpectForErrorCase("tbt_QuotationSentryGuardDetails");
            dtBatchProcessResult actual   = null;
            string error = string.Empty;

            try
            {
                List <dtBatchProcessResult> lst = target.DeleteQuotation();
                actual = lst[0];
            }
            catch (ApplicationErrorException ex)
            {
                error = ex.ErrorResult.Message.Code;
            }
            catch (Exception ex)
            {
                error = ex.StackTrace;
            }

            if (error == string.Empty)
            {
                return(CompareDtBatchProcessResult(actual, expected, 2));
            }
            else
            {
                return(string.Format(RESULT_FORMAT_ERROR, 2, "Fail", error));
            }
        }
コード例 #2
0
        private string CompareDtBatchProcessResult(dtBatchProcessResult actual, dtBatchProcessResult expect, int caseNo)
        {
            bool bResult = CompareObject <dtBatchProcessResult>(actual, expect);

            string result = string.Format(RESULT_FORMAT_LIST, caseNo, bResult);

            //result += string.Format(RESULT_FORMAT_LIST_DATA, caseNo, "ErrorMessage", actual.ErrorMessage);

            return(result);
        }
コード例 #3
0
        private dtBatchProcessResult CreateExpectForErrorCase(string strTableName)
        {
            dtBatchProcessResult dtBatch = new dtBatchProcessResult();

            dtBatch.Result       = false;
            dtBatch.BatchStatus  = null;
            dtBatch.Total        = 14;
            dtBatch.Complete     = 0;
            dtBatch.Failed       = 14;
            dtBatch.ErrorMessage = String.Format("Delete quotation process is failed. Cannot delete {0}. All deleted data is rollbacked.", strTableName);

            return(dtBatch);
        }
コード例 #4
0
        private dtBatchProcessResult CreateExpectForNormalCase()
        {
            dtBatchProcessResult dtBatch = new dtBatchProcessResult();

            dtBatch.Result       = true;
            dtBatch.BatchStatus  = null;
            dtBatch.Total        = 14;
            dtBatch.Complete     = 14;
            dtBatch.Failed       = 0;
            dtBatch.ErrorMessage = null;

            return(dtBatch);
        }