public void TestUpdatesProperties_NoGlobalSecurityController()
 {
     //-------------Setup Test Pack ------------------
     BOProp dateBoProp = new BOProp(new PropDef("DateLastUpdated", typeof(DateTime), PropReadWriteRule.ReadWrite, null));
     BOProp userBoProp = new BOProp(new PropDef("UserLastUpdated", typeof(string), PropReadWriteRule.ReadWrite, null));
     BusinessObjectLastUpdatePropertiesLog log = new BusinessObjectLastUpdatePropertiesLog(userBoProp, dateBoProp);
     //-------------Test Pre-conditions --------------
     Assert.IsNull(userBoProp.Value);
     //-------------Execute test ---------------------
     DateTime beforeUpdate = DateTime.Now;
     log.Update();
     DateTime afterUpdate = DateTime.Now;
     //-------------Test Result ----------------------
     Assert.IsNotNull(userBoProp.Value);
     Assert.AreEqual(Environment.UserName, userBoProp.Value);
     Assert.IsNotNull(dateBoProp.Value);
     Assert.IsTrue(beforeUpdate <= (DateTime)dateBoProp.Value);
     Assert.IsTrue(afterUpdate >= (DateTime)dateBoProp.Value);
     
 }
 public void TestUpdatesProperties_GivenBo_WithoutUserNameAndDate()
 {
     //-------------Setup Test Pack ------------------
     new Engine(); new Car();
     ContactPerson contactPerson = new ContactPerson();
     contactPerson.Props.Remove("DateLastUpdated");
     contactPerson.Props.Remove("UserLastUpdated");
     contactPerson.CancelEdits();
     ISecurityController securityController = new MySecurityController();
     GlobalRegistry.SecurityController = securityController;
     BusinessObjectLastUpdatePropertiesLog log = new BusinessObjectLastUpdatePropertiesLog(contactPerson);
     //-------------Test Pre-conditions --------------
     //-------------Execute test ---------------------       
     log.Update();
     //-------------Test Result ----------------------
     //Should give no errors.
 }
 public void TestUpdatesProperties_GivenBo_UserNameAndDate_AndSecurityController()
 {
     //-------------Setup Test Pack ------------------
     
     new Engine(); new Car();
     ContactPerson contactPerson = new ContactPerson();
     IBOProp dateBoProp = contactPerson.Props["DateLastUpdated"];
     IBOProp userBoProp = contactPerson.Props["UserLastUpdated"];
     contactPerson.CancelEdits();
     ISecurityController securityController = new MySecurityController();
     BusinessObjectLastUpdatePropertiesLog log = new BusinessObjectLastUpdatePropertiesLog(contactPerson, securityController);
     //-------------Test Pre-conditions --------------
     //-------------Execute test ---------------------       
     DateTime beforeUpdate = DateTime.Now;
     log.Update();
     DateTime afterUpdate = DateTime.Now;
     //-------------Test Result ----------------------
     Assert.IsNotNull(userBoProp.Value);
     Assert.AreEqual("MyUserName", userBoProp.Value);
     Assert.IsNotNull(dateBoProp.Value);
     Assert.IsTrue(beforeUpdate <= (DateTime)dateBoProp.Value);
     Assert.IsTrue(afterUpdate >= (DateTime)dateBoProp.Value);
 }