Beispiel #1
0
        public void ExecuteTransaction_ThrowsExceptionGivenADataTableWithInvalidRows()
        {
            var database = new SqlDb(_testConn);
            var testCommand = StoredProcedureFactory.Create("SqlDb_ExecuteTransactionAndReturnTransactionStatusTestProcedure3");

            try
            {
                database.ExecuteTransaction(testCommand, "Execute Transaction Failed");
            }
            catch (ExecuteTransactionFormatException testException)
            {
                TestUtility.TestExceptionMessage(testException,
                    "The TransactionStatus object expects exactly one row to be returned by the procedure.");
            }
            catch (Exception ex)
            {
                throw new Exception("Test Failed", ex);
            }
        }
Beispiel #2
0
 public void ExecuteTransaction_ThrowsDbCommandExceptionWhenCommandDoesntExist()
 {
     var database = new SqlDb(_testConn);
     var testCommand = StoredProcedureFactory.Create("BogusCommand");
     database.ExecuteTransaction(testCommand, "Execute Transaction Failed");
 }
Beispiel #3
0
 public void ExecuteTransaction_ThrowsExceptionGivenADataTableWithInvalidColumns()
 {
     var database = new SqlDb(_testConn);
     var testCommand = StoredProcedureFactory.Create("SqlDb_ExecuteTransactionAndReturnTransactionStatusTestProcedure2");
     try
     {
         database.ExecuteTransaction(testCommand, "Execute Transaction Failed");
     }
     catch (ExecuteTransactionFormatException testException)
     {
         TestUtility.TestExceptionMessage(testException,
             "The data table returned cannot be used by the TransactionStatus object since it does not contain one or all of the following columns: ErrorCode, ErrorMessage, TransactionInfo.");
     }
     catch (Exception ex)
     {
         throw new Exception("Test Failed", ex);
     }
 }
Beispiel #4
0
        public void ExecuteTransaction_ReturnsTransactionStatusGivenAValidDataTable()
        {
            var database = new SqlDb(_testConn);
            var testCommand = StoredProcedureFactory.Create("SqlDb_ExecuteTransactionAndReturnTransactionStatusTestProcedure1");

            var status = database.ExecuteTransaction(testCommand, "Execute Transaction Failed");

            Assert.AreEqual(string.Format("{0}, {1}, {2}", TransactionStatusCode.Cancelled, "There were no source records. Operation not executed", ""), status.ToString());
        }