Ejemplo n.º 1
0
        public void Test_ObjectID_SetObjectGuidID_Twice()
        {
            //--------------- Set up test pack ------------------
            BOPrimaryKey primaryKey = CreateBOPrimaryKeyString();
            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);
            }
        }
Ejemplo n.º 2
0
        public void Test_ObjectID_SetObjectGuidID()
        {
            //--------------- Set up test pack ------------------
            BOPrimaryKey primaryKey = CreateBOPrimaryKeyString();
            Guid         id         = Guid.NewGuid();

            //--------------- Test Preconditions ----------------
            Assert.AreEqual(Guid.Empty, primaryKey.ObjectID);
            //--------------- Execute Test ----------------------
            primaryKey.SetObjectGuidID(id);
            //--------------- Test Result -----------------------
            Assert.AreEqual(id, primaryKey.ObjectID);
        }
Ejemplo n.º 3
0
        public void Test_AsString_CurrentValue_TwoPropKey()
        {
            //--------------- Set up test pack ------------------
            BOPrimaryKey primaryKey = CreatePrimaryBOKeyGuidAndString();
            Guid         guid       = Guid.NewGuid();

            //--------------- Test Preconditions ----------------

            //--------------- Execute Test ----------------------
            primaryKey.SetObjectGuidID(guid);
            string keyAsString = primaryKey.AsString_CurrentValue();

            //--------------- Test Result -----------------------
            StringAssert.AreEqualIgnoringCase(guid.ToString(), keyAsString);
        }
Ejemplo n.º 4
0
        public void Test_AsString_PreviousValue()
        {
            //--------------- Set up test pack ------------------
            BOPrimaryKey primaryKey   = CreateBOObjectID();
            Guid         originalGuid = Guid.NewGuid();

            //--------------- Test Preconditions ----------------

            //--------------- Execute Test ----------------------
            primaryKey.SetObjectGuidID(originalGuid);
            string keyAsString = primaryKey.AsString_PreviousValue();

            //--------------- Test Result -----------------------
            StringAssert.AreEqualIgnoringCase(originalGuid.ToString(), keyAsString);
        }
Ejemplo n.º 5
0
        public void Test_AsString_PreviousValue_SetValue()
        {
            //--------------- Set up test pack ------------------
            BOPrimaryKey primaryKey = CreateBOPrimaryKeyString();
            Guid         guid       = Guid.NewGuid();
            string       str        = TestUtil.GetRandomString();

            //--------------- Test Preconditions ----------------

            //--------------- Execute Test ----------------------
            primaryKey.SetObjectGuidID(guid);
            primaryKey[0].Value = str;
            string keyAsString = primaryKey.AsString_PreviousValue();

            //--------------- Test Result -----------------------
            StringAssert.AreEqualIgnoringCase(guid.ToString(), keyAsString);
        }
Ejemplo n.º 6
0
        public void Test_AsString_CurrentValue_TwoPropKey_SetTwoProp()
        {
            //--------------- Set up test pack ------------------
            BOPrimaryKey primaryKey = CreatePrimaryBOKeyGuidAndString();
            Guid         guid       = Guid.NewGuid();

            primaryKey.SetObjectGuidID(guid);
            primaryKey[0].Value = Guid.NewGuid();
            primaryKey[1].Value = TestUtil.GetRandomString();
            //--------------- Test Preconditions ----------------

            //--------------- Execute Test ----------------------
            string keyAsString = primaryKey.AsString_CurrentValue();

            //--------------- Test Result -----------------------
            Assert.AreNotEqual(guid.ToString(), keyAsString);
            Assert.AreEqual("ContactPersonTestBO.PropName1=" + primaryKey[0].Value + ";ContactPersonTestBO.PropName2=" + primaryKey[1].Value, keyAsString);
        }
Ejemplo n.º 7
0
        public void Test_AsString_PreviousValue_TwoPropKey_ResetOneProp()
        {
            //--------------- Set up test pack ------------------
            BOPrimaryKey primaryKey = CreatePrimaryBOKeyGuidAndString();
            Guid         guid       = Guid.NewGuid();

            primaryKey.SetObjectGuidID(guid);
            primaryKey[0].Value = Guid.NewGuid();
            primaryKey[1].Value = TestUtil.GetRandomString();
            string origKeyAsString = primaryKey.AsString_CurrentValue();

            //--------------- Test Preconditions ----------------

            //--------------- Execute Test ----------------------
            primaryKey[1].Value = TestUtil.GetRandomString();
            string keyAsString = primaryKey.AsString_PreviousValue();

            //--------------- Test Result -----------------------
            Assert.AreNotEqual(guid.ToString(), keyAsString);
            Assert.AreEqual(origKeyAsString, keyAsString);
        }
Ejemplo n.º 8
0
        public void Test_AsString_PreviousValue_SetValueTwice()
        {
            //--------------- Set up test pack ------------------
            BOPrimaryKey primaryKey = CreateBOPrimaryKeyString();
            Guid         guid       = Guid.NewGuid();

            primaryKey.SetObjectGuidID(guid);
            string str1 = TestUtil.GetRandomString();

            primaryKey[0].Value = str1;
            string str2 = TestUtil.GetRandomString();

            //--------------- Test Preconditions ----------------

            //--------------- Execute Test ----------------------
            primaryKey[0].Value = str2;
            string keyAsString = primaryKey.AsString_PreviousValue();

            //--------------- Test Result -----------------------
            StringAssert.AreEqualIgnoringCase("ContactPersonTestBO.PropName1=" + str1, keyAsString);
        }