public void Test_ObjectID_SetObjectGuidID_Twice() { //--------------- Set up test pack ------------------ BOObjectID primaryKey = CreateBOObjectID(); Guid id = Guid.NewGuid(); primaryKey.SetObjectGuidID(id); //--------------- Test Preconditions ---------------- Assert.AreEqual(id, primaryKey.ObjectID); //--------------- Execute Test ---------------------- try { primaryKey.SetObjectGuidID(Guid.NewGuid()); //--------------- Test Result ----------------------- Assert.Fail("InvalidObjectIdException expected"); } catch (InvalidObjectIdException ex) { Assert.AreEqual("The ObjectGuidID has already been set for this object.", ex.Message); Assert.AreEqual(id, primaryKey.ObjectID); } }
public void Test_ObjectID_SetObjectGuidID() { //--------------- Set up test pack ------------------ BOObjectID primaryKey = CreateBOObjectID(); Guid id = Guid.NewGuid(); //--------------- Test Preconditions ---------------- Assert.AreEqual(Guid.Empty, primaryKey.ObjectID); //--------------- Execute Test ---------------------- primaryKey.SetObjectGuidID(id); //--------------- Test Result ----------------------- Assert.AreEqual(id, primaryKey.ObjectID); }
public void Test_SetObjectID_SetsThePreviousObjectID() { //--------------- Set up test pack ------------------ BOObjectID primaryKey = CreateBOObjectID(); Guid id = Guid.NewGuid(); //--------------- Test Preconditions ---------------- Assert.AreEqual(Guid.Empty, primaryKey.ObjectID); Assert.AreEqual(Guid.Empty, primaryKey.PreviousObjectID); //--------------- Execute Test ---------------------- primaryKey.SetObjectGuidID(id); //--------------- Test Result ----------------------- IBOProp iboProp = primaryKey[0]; Assert.AreEqual(id, primaryKey.ObjectID); Assert.AreEqual(id, iboProp.Value); Assert.AreEqual(id, primaryKey.PreviousObjectID); }
public void Test_ObjectID_ResetObjectIDProperty() { //--------------- Set up test pack ------------------ BOObjectID primaryKey = CreateBOObjectID(); Guid id = Guid.NewGuid(); primaryKey.SetObjectGuidID(id); IBOProp iboProp = primaryKey[0]; Guid newID = Guid.NewGuid(); //--------------- Test Preconditions ---------------- Assert.AreEqual(id, primaryKey.ObjectID); Assert.AreEqual(id, iboProp.Value); Assert.AreEqual(id, primaryKey.PreviousObjectID); //--------------- Execute Test ---------------------- iboProp.Value = newID; //--------------- Test Result ----------------------- Assert.AreEqual(id, primaryKey.PreviousObjectID); Assert.AreEqual(newID, iboProp.Value); Assert.AreEqual(newID, primaryKey.ObjectID); }