Beispiel #1
0
        private static ContactPersonTransactionLogging CreateUnsavedContactPersonTransactionLogging()
        {
            ContactPersonTransactionLogging cp = new ContactPersonTransactionLogging();

            cp.Surname = Guid.NewGuid().ToString();
            return(cp);
        }
Beispiel #2
0
 public void TestFixtureSetup()
 {
     //Code that is executed before any test is run in this class. If multiple tests
     // are executed then it will still only be called once.
     base.SetupDBConnection();
     ClassDef.ClassDefs.Clear();
     ContactPersonTransactionLogging.LoadDefaultClassDef();
     TransactionLogBusObj.LoadClassDef();
 }
Beispiel #3
0
        public void TestTransactionLogPersistsSQL_AddedToBusinessObjectPersistsSql()
        {
            //---------------Set up test pack-------------------
            //Create Mock Business object that implements a stub transaction log.
            ContactPersonTransactionLogging cp = CreateUnsavedContactPersonTransactionLogging();
            TransactionalBusinessObjectDB   transactionalBODB = new TransactionalBusinessObjectDB(cp, DatabaseConnection.CurrentConnection);

            //---------------Assert Preconditions --------------

            //---------------Execute Test ----------------------
            var sqlStatementCollection = transactionalBODB.GetPersistSql();
            //---------------Test Result -----------------------
            //check if the transaction committer has 2 object
            // check that the one object is the transaction log object.
            var sqlStatements = sqlStatementCollection.ToList();

            Assert.AreEqual(2, sqlStatements.Count);
            ISqlStatement       sqlStatement        = sqlStatements[1];
            TransactionLogTable transactionLogTable = new TransactionLogTable(cp);

            Assert.AreEqual(transactionLogTable.GetPersistSql().First().Statement.ToString(), sqlStatement.Statement.ToString());
        }
Beispiel #4
0
        public void TestTransactionLogPersistsSQL_NotAddedToBusinessObjectPersistsSql_WhenObjectUnchanged()
        {
            //---------------Set up test pack-------------------
            //Create Mock Business object that implements a stub transaction log.
            ContactPersonTransactionLogging cp = CreateUnsavedContactPersonTransactionLogging();
            TransactionCommitterStub        tc = new TransactionCommitterStub();

            tc.AddBusinessObject(cp);
            tc.CommitTransaction();
            TransactionalBusinessObjectDB transactionalBODB = new TransactionalBusinessObjectDB(cp, DatabaseConnection.CurrentConnection);

            //---------------Assert Preconditions --------------

            //---------------Execute Test ----------------------
            IEnumerable <ISqlStatement> sqlStatementCollection = transactionalBODB.GetPersistSql();

            //---------------Test Result -----------------------
            //check if the transaction committer has 2 object
            // check that the one object is the transaction log object.
            Assert.AreEqual(0, sqlStatementCollection.Count());
            //ISqlStatement sqlStatement = sqlStatementCollection[1];
            //TransactionLogTable transactionLogTable = new TransactionLogTable(cp);
            //Assert.AreEqual(transactionLogTable.GetPersistSql()[0].Statement.ToString(), sqlStatement.Statement.ToString());
        }