public void AddModifyDeleteFieldDescription()
        {
            FieldDescription fd = new FieldDescription(Cache)
            {
                Class = 1,
                Name  = "TESTJUNK___NotPresent",
                Type  = CellarPropertyType.Boolean
            };

            Assert.AreEqual(fd.Custom, 1, "Wrong value for Custom column in new FD.");
            Assert.AreEqual(0, fd.Id, "new field should not have been assigned a flid yet");

            int flid;

            try
            {
                flid = m_mdc.GetFieldId2(fd.Class, fd.Name, true);
            }
            catch (LcmInvalidFieldException)
            {
                flid = 0;                       // the new implementation throws instead of returning zero.
            }
            Assert.AreEqual(0, flid, "new field should not exist");

            fd.UpdateCustomField();
            flid = m_mdc.GetFieldId2(fd.Class, fd.Name, true);
            Assert.AreNotEqual(0, fd.Id, "field should have been assigned a flid");
            Assert.AreEqual(fd.Id, flid, "new field should exist");

            string hs = "Abandon hope all ye who enter here.";

            fd.HelpString = hs;
            fd.UpdateCustomField();
            string help = m_mdc.GetFieldHelp(fd.Id);

            Assert.AreEqual(hs, help, "Help string should have been updated");

            fd.MarkForDeletion = true;
            fd.UpdateCustomField();
            try
            {
                flid = m_mdc.GetFieldId2(fd.Class, fd.Name, true);
            }
            catch (LcmInvalidFieldException)
            {
                flid = 0;                       // the new implementation throws instead of returning zero.
            }
            Assert.AreEqual(0, flid, "new field should have been deleted");
        }
Beispiel #2
0
 /// <summary> Gets the help string of a field. </summary>
 /// <param name='luFlid'>Field identification number. In the database, this corresponds to the "Id"
 /// column in the Field$ table. </param>
 /// <returns>Points to the output help string of the field. In the database, this
 /// corresponds to the "HelpString" column in the Field$ table.</returns>
 public virtual string GetFieldHelp(int luFlid)
 {
     return(m_metaDataCache.GetFieldHelp(luFlid));
 }