public void AddNewFieldDescriptionWithOldName()
        {
            // Setup test
            var origName = "zCustom Field";
            var newName  = "zNew Custom Field User label";

            CreateCustomFieldAndRelabel(origName, newName);
            var firstFlid       = m_mdc.GetFieldId2(1, origName, true);
            var secondUserLabel = "unrelatedUserLabel";
            var customField2    = new FieldDescription(Cache)
            {
                Class     = 1,
                Name      = origName,
                Userlabel = secondUserLabel,
                Type      = CellarPropertyType.String
            };

            // SUT
            customField2.UpdateCustomField();             // should change Name slightly

            // Verify
            var newExpectedName = origName + "1";
            var secondFlid      = m_mdc.GetFieldId2(customField2.Class, newExpectedName, true);

            Assert.AreNotEqual(0, secondFlid, "Field not, or incorrectly, installed.");
            var actualNewName = m_mdc.GetFieldName(secondFlid);

            Assert.AreEqual(newExpectedName, actualNewName,
                            string.Format("Field Name should be changed to {0}.", newExpectedName));
            Assert.AreEqual(secondUserLabel, m_mdc.GetFieldLabel(secondFlid), "User label shouldn't change.");

            // Cleanup
            m_mdc.DeleteCustomField(firstFlid);
            m_mdc.DeleteCustomField(secondFlid);
        }
Beispiel #2
0
 public void DeleteCustomField(int flid)
 {
     m_metaDataCache.DeleteCustomField(flid);
 }