コード例 #1
0
ファイル: SqlDbTests.cs プロジェクト: hogberg43/App
        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);
            }
        }
コード例 #2
0
ファイル: SqlDbTests.cs プロジェクト: hogberg43/App
 public void ExecuteTransaction_ThrowsDbCommandExceptionWhenCommandDoesntExist()
 {
     var database = new SqlDb(_testConn);
     var testCommand = StoredProcedureFactory.Create("BogusCommand");
     database.ExecuteTransaction(testCommand, "Execute Transaction Failed");
 }
コード例 #3
0
ファイル: SqlDbTests.cs プロジェクト: hogberg43/App
 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);
     }
 }
コード例 #4
0
ファイル: SqlDbTests.cs プロジェクト: hogberg43/App
        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());
        }