Ejemplo n.º 1
0
        public void TestAcceptanceTransactionLog_DB_NewContactPerson()
        {
            //Test that the transaction log
            //---------------Set up test pack-------------------
            ContactPersonTransactionLogging cp = CreateUnsavedContactPersonTransactionLogging();
            TransactionCommitterDB          tc = new TransactionCommitterDB(DatabaseConnection.CurrentConnection);

            tc.AddBusinessObject(cp);
            string dirtyXML = cp.DirtyXML;

            //---------------Execute Test ----------------------
            tc.CommitTransaction();
            //---------------Test Result -----------------------
            //Test that a transaction Log was created with
            BusinessObjectCollection <TransactionLogBusObj> colTransactions =
                new BusinessObjectCollection <TransactionLogBusObj>();

            colTransactions.LoadAll("TransactionSequenceNo");

            //CRUD = Insert and Dirty XML all properties in DirtyXML.
            Assert.IsTrue(colTransactions.Count > 0);
            TransactionLogBusObj trLog = colTransactions[colTransactions.Count - 1];

            Assert.AreEqual("Created", trLog.CrudAction);
            Assert.AreEqual(dirtyXML, trLog.DirtyXMLLog);
            Assert.AreEqual("ContactPersonTransactionLogging", trLog.BusinessObjectTypeName);
            //Assert.AreEqual(WindowsIdentity.GetCurrent().Name, trLog.WindowsUser);
            Assert.AreEqual(Environment.MachineName, trLog.MachineUpdatedName);
            //Assert.GreaterOrEqual(trLog.DateTimeUpdated, DateTime.Now.AddMinutes(-1));
            Assert.LessOrEqual(trLog.DateTimeUpdated, DateTime.Now.AddSeconds(1));
            Assert.AreEqual(cp.ToString(), trLog.BusinessObjectToString);
            //---------------Tear Down -------------------------
        }
Ejemplo n.º 2
0
        public void TestAcceptanceTransactionLog_DB_EditContactPerson()
        {
            //Test that the transaction log
            //---------------Set up test pack-------------------
            ContactPersonTransactionLogging cp = CreateUnsavedContactPersonTransactionLogging();
            TransactionCommitterDB          tc = new TransactionCommitterDB(DatabaseConnection.CurrentConnection);

            tc.AddBusinessObject(cp);
            tc.CommitTransaction();
            tc         = new TransactionCommitterDB(DatabaseConnection.CurrentConnection);
            cp.Surname = Guid.NewGuid().ToString();
            tc.AddBusinessObject(cp);
            //---------------Execute Test ----------------------
            tc.CommitTransaction();
            //---------------Test Result -----------------------
            //Test that a transaction Log was created with
            BusinessObjectCollection <TransactionLogBusObj> colTransactions =
                new BusinessObjectCollection <TransactionLogBusObj>();

            colTransactions.LoadAll("TransactionSequenceNo");

            //CRUD = Insert and Dirty XML all properties in DirtyXML.
            Assert.IsTrue(colTransactions.Count > 0);
            TransactionLogBusObj trLog = colTransactions[colTransactions.Count - 1];

            //CRUD = Edited
            Assert.AreEqual("Updated", trLog.CrudAction);

            //---------------Tear Down -------------------------
        }
Ejemplo n.º 3
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();
 }