public void TestAcceptanceTransactionLog_SaveMultipleTimes() { //---------------Cleanup databse ------------------ CleanDB(); //---------------Set up test pack------------------- ContactPersonTransactionLogging cp = CreateUnsavedContactPersonTransactionLogging(); cp.Save(); //---------------Execute Test ---------------------- cp.Surname = Guid.NewGuid().ToString(); cp.Save(); cp.Surname = Guid.NewGuid().ToString(); cp.Save(); cp.Surname = Guid.NewGuid().ToString(); cp.Save(); cp.Surname = Guid.NewGuid().ToString(); cp.Save(); cp.MarkForDelete(); cp.Save(); BusinessObjectCollection <TransactionLogBusObj> colTransactions = new BusinessObjectCollection <TransactionLogBusObj>(); colTransactions.LoadAll(); //cp = CreateUnsavedContactPersonTransactionLogging(); //cp.Save(); //---------------Test Result ----------------------- //Test that a transaction Log was created with Assert.AreEqual(6, colTransactions.Count); //---------------Tear Down ------------------------- }
public void TestAcceptanceTransactionLog_DB_DeleteContactPerson() { //---------------Set up test pack------------------- ContactPersonTransactionLogging cp = CreateUnsavedContactPersonTransactionLogging(); TransactionCommitterDB tc = new TransactionCommitterDB(DatabaseConnection.CurrentConnection); tc.AddBusinessObject(cp); tc.CommitTransaction(); cp.MarkForDelete(); tc = new TransactionCommitterDB(DatabaseConnection.CurrentConnection); tc.AddBusinessObject(cp); //---------------Execute Test ---------------------- tc.CommitTransaction(); //---------------Test Result ----------------------- //Test that a transaction Log was created with var colTransactions = new BusinessObjectCollection <TransactionLogBusObj>(); colTransactions.LoadAll("TransactionSequenceNo"); //CRUD = Insert and Dirty XML all properties in DirtyXML. Assert.IsTrue(colTransactions.Count > 0); var trLog = colTransactions[colTransactions.Count - 1]; //CRUD = Deleted Assert.AreEqual("Deleted", trLog.CrudAction); //---------------Tear Down ------------------------- }