Пример #1
0
        public void CustomUsageNoteWithMultiString()
        {
            var cfiList = new List <CustomFieldInfo>
            {
                new CustomFieldInfo {
                    m_classname = "LexSense", m_fieldname = "UsageNote", m_fieldType = CellarPropertyType.MultiString
                }
            };

            BackendProvider.PreLoadCustomFields(cfiList);

            Assert.AreEqual(0, cfiList.Count, "Identical Custom Field should have been removed");
        }
Пример #2
0
        public void CustomUsageNoteWithInteger()
        {
            var cfiList = new List <CustomFieldInfo>
            {
                new CustomFieldInfo {
                    m_classname = "LexSense", m_fieldname = "UsageNote", m_fieldType = CellarPropertyType.Integer
                }
            };

            BackendProvider.PreLoadCustomFields(cfiList);

            Assert.AreEqual(1, cfiList.Count);
            Assert.AreEqual("LexSense", cfiList[0].m_classname);
            // uses first available number to rename old UsageNote, which in this case is UsageNote0.
            Assert.AreEqual("UsageNote0", cfiList[0].m_fieldname);
        }
Пример #3
0
        public void MultipleConflictingCustomFields()
        {
            var cfiList = new List <CustomFieldInfo>
            {
                new CustomFieldInfo {
                    m_classname = "LexSense", m_fieldname = "UsageNote"
                },
                new CustomFieldInfo {
                    m_classname = "LexSense", m_fieldname = "UsageNote0"
                },
                new CustomFieldInfo {
                    m_classname = "LexSense", m_fieldname = "UsageNote3"
                },
                new CustomFieldInfo {
                    m_classname = "LexSense", m_fieldname = "Exemplar"
                },
                new CustomFieldInfo {
                    m_classname = "LexSense", m_fieldname = "Exemplar0"
                },
                new CustomFieldInfo {
                    m_classname = "LexSense", m_fieldname = "Exemplar1"
                }
            };

            BackendProvider.PreLoadCustomFields(cfiList);

            Assert.AreEqual(6, cfiList.Count);
            foreach (var cfi in cfiList)
            {
                Assert.AreEqual("LexSense", cfi.m_classname, "Classname should not have changed");
            }

            // uses first available number to rename old UsageNote, which in this case is UsageNote1.
            Assert.AreEqual("UsageNote1", cfiList[0].m_fieldname);
            Assert.AreEqual("UsageNote0", cfiList[1].m_fieldname);
            Assert.AreEqual("UsageNote3", cfiList[2].m_fieldname);
            // uses first available number to rename old Exemplar, which in this case is Exemplar2.
            Assert.AreEqual("Exemplar2", cfiList[3].m_fieldname);
            Assert.AreEqual("Exemplar0", cfiList[4].m_fieldname);
            Assert.AreEqual("Exemplar1", cfiList[5].m_fieldname);
        }