示例#1
0
        public void Test_Cloned_Equals_True()
        {
            //---------------Set up test pack-------------------
            PropDef propDef = new PropDef("TestPropDef", "System", "String", PropReadWriteRule.ReadWrite, "TestPropDef", "TestString", true, false);
            IPropDef clonedPropDef = propDef.Clone();

            //-----Test PreCondition--------------------------
            //---------------Execute Test ----------------------
            bool equals = propDef.Equals(clonedPropDef);
            //---------------Test Result -----------------------
            Assert.IsTrue(equals, "Cloned def should be equal");
        }
示例#2
0
        public void Test_Clone()
        {
            //---------------Set up test pack-------------------
            PropDef propDef = new PropDef("TestPropDef","System","String",PropReadWriteRule.ReadWrite, "TestPropDef","TestString",true,false);
            
            //---------------Execute Test ----------------------
            PropDef clonedPropDef = (PropDef) propDef.Clone();
            //-----Test PreCondition--------------------------
            Assert.AreEqual(propDef.PropertyTypeAssemblyName, clonedPropDef.PropertyTypeAssemblyName);
            Assert.AreEqual(propDef.PropertyType, clonedPropDef.PropertyType);
            Assert.AreEqual(propDef.PropertyTypeName, clonedPropDef.PropertyTypeName);
            Assert.AreEqual(propDef.Compulsory, clonedPropDef.Compulsory);
            Assert.AreEqual(propDef.DefaultValueString, clonedPropDef.DefaultValueString);
            Assert.AreEqual(propDef.ReadWriteRule, clonedPropDef.ReadWriteRule);
            Assert.IsTrue(propDef.Equals(clonedPropDef), "Cloned prop def should equal orig propdef");

            //-----------Execute------------------------------
            clonedPropDef.Compulsory = false;
            clonedPropDef.DefaultValueString = "ClonedString";
            clonedPropDef.ReadWriteRule = PropReadWriteRule.WriteOnce;

            //---------------Test Result -----------------------
            Assert.AreNotEqual(propDef.Compulsory,clonedPropDef.Compulsory);
            Assert.AreNotEqual(propDef.DefaultValueString,clonedPropDef.DefaultValueString);
            Assert.AreNotEqual(propDef.ReadWriteRule,clonedPropDef.ReadWriteRule);
            Assert.IsFalse(propDef.Equals(clonedPropDef));
        }