public void TestNotCalledByBusinessObjectInUpdateObjectBeforePersisting_Deleted() { //-------------Setup Test Pack ------------------ TransactionCommitterStub transactionCommitterStub = new TransactionCommitterStub(); MyBusinessObjectUpdateLogBo myBusinessObjectUpdateLogBo = new MyBusinessObjectUpdateLogBo(); transactionCommitterStub.AddBusinessObject(myBusinessObjectUpdateLogBo); transactionCommitterStub.CommitTransaction(); BusinessObjectUpdateLogStub businessObjectUpdateLog = myBusinessObjectUpdateLogBo.BusinessObjectUpdateLog as BusinessObjectUpdateLogStub; myBusinessObjectUpdateLogBo.MarkForDelete(); transactionCommitterStub = new TransactionCommitterStub(); transactionCommitterStub.AddBusinessObject(myBusinessObjectUpdateLogBo); //-------------Test Pre-conditions -------------- Assert.IsFalse(myBusinessObjectUpdateLogBo.Status.IsNew, "BusinessObject should not be new"); Assert.IsTrue(myBusinessObjectUpdateLogBo.Status.IsDeleted, "BusinessObject should be deleted"); Assert.IsNotNull(businessObjectUpdateLog); businessObjectUpdateLog.Called = false; //-------------Execute test --------------------- myBusinessObjectUpdateLogBo.UpdateObjectBeforePersisting(transactionCommitterStub); //-------------Test Result ---------------------- Assert.IsFalse(businessObjectUpdateLog.Called, "BusinessObject Update Log should have been called upon persisting."); }
public void TestSetupBusinessObjectUpdateLog() { //-------------Setup Test Pack ------------------ //-------------Test Pre-conditions -------------- //-------------Execute test --------------------- MyBusinessObjectUpdateLogBo myBusinessObjectUpdateLogBo = new MyBusinessObjectUpdateLogBo(); //-------------Test Result ---------------------- IBusinessObjectUpdateLog businessObjectUpdateLog = myBusinessObjectUpdateLogBo.BusinessObjectUpdateLog; Assert.IsNotNull(businessObjectUpdateLog); Assert.IsInstanceOf(typeof(BusinessObjectUpdateLogStub), businessObjectUpdateLog); }
public void TestSetupBusinessObjectUpdateLog() { //-------------Setup Test Pack ------------------ //-------------Test Pre-conditions -------------- //-------------Execute test --------------------- MyBusinessObjectUpdateLogBo myBusinessObjectUpdateLogBo = new MyBusinessObjectUpdateLogBo(); //-------------Test Result ---------------------- IBusinessObjectUpdateLog businessObjectUpdateLog = myBusinessObjectUpdateLogBo.BusinessObjectUpdateLog; Assert.IsNotNull(businessObjectUpdateLog); Assert.IsInstanceOf(typeof(BusinessObjectUpdateLogStub), businessObjectUpdateLog); }
public void TestCalledByBusinessObjectInUpdateObjectBeforePersisting_New() { //-------------Setup Test Pack ------------------ TransactionCommitterStub transactionCommitterStub = new TransactionCommitterStub(); MyBusinessObjectUpdateLogBo myBusinessObjectUpdateLogBo = new MyBusinessObjectUpdateLogBo(); BusinessObjectUpdateLogStub businessObjectUpdateLog = myBusinessObjectUpdateLogBo.BusinessObjectUpdateLog as BusinessObjectUpdateLogStub; transactionCommitterStub.AddBusinessObject(myBusinessObjectUpdateLogBo); //-------------Test Pre-conditions -------------- Assert.IsTrue(myBusinessObjectUpdateLogBo.Status.IsNew, "BusinessObject should be new"); Assert.IsFalse(myBusinessObjectUpdateLogBo.Status.IsDeleted, "BusinessObject should not be deleted"); Assert.IsNotNull(businessObjectUpdateLog); Assert.IsFalse(businessObjectUpdateLog.Called, "BusinessObject Update Log should not have been called upon persisting."); //-------------Execute test --------------------- myBusinessObjectUpdateLogBo.UpdateObjectBeforePersisting(transactionCommitterStub); //-------------Test Result ---------------------- Assert.IsTrue(businessObjectUpdateLog.Called, "BusinessObject Update Log should have been called upon persisting."); }
public void SetupTest() { //Runs every time that any testmethod is executed ClassDef.ClassDefs.Clear(); MyBusinessObjectUpdateLogBo.LoadDefaultClassDef(); }