예제 #1
0
        private void EnsureFactoryForClass(string sClassName)
        {
            switch (sClassName)
            {
            case "CmPossibility":
                if (m_factPoss == null)
                {
                    m_factPoss = m_cache.ServiceLocator.GetInstance <ICmPossibilityFactory>();
                }
                break;

            case "CmAnthroItem":
                if (m_factAnthro == null)
                {
                    m_factAnthro = m_cache.ServiceLocator.GetInstance <ICmAnthroItemFactory>();
                }
                break;

            case "CmSemanticDomain":
                if (m_factSemDom == null)
                {
                    m_factSemDom = m_cache.ServiceLocator.GetInstance <ICmSemanticDomainFactory>();
                }
                break;

            case "CmDomainQ":
                if (m_factCmDomainQ == null)
                {
                    m_factCmDomainQ = m_cache.ServiceLocator.GetInstance <ICmDomainQFactory>();
                }
                break;

            case "PartOfSpeech":
                if (m_factPOS == null)
                {
                    m_factPOS = m_cache.ServiceLocator.GetInstance <IPartOfSpeechFactory>();
                }
                break;

            default:
                // TODO: implement the other subclasses of CmPossibility.
                throw new NotImplementedException();
            }
        }
예제 #2
0
        public void CmSemanticDomainReferringSensesAreSorted()
        {
            ICmSemanticDomainFactory factSemDom = Cache.ServiceLocator.GetInstance <ICmSemanticDomainFactory>();
            var semDom = factSemDom.Create() as CmSemanticDomain;

            Cache.LangProject.SemanticDomainListOA.PossibilitiesOS.Add(semDom);
            ILexEntry lezzz   = MakeLexEntry("zzz", "zzzDefn", semDom);
            ILexEntry lerrr   = MakeLexEntry("rrr", "rrrDefn", semDom);
            ILexEntry leabc   = MakeLexEntry("abc", "abcDefn", semDom);
            ILexEntry leaa    = MakeLexEntry("aa", "aaDefn", semDom);
            ILexEntry lemnop  = MakeLexEntry("mnop", "gloss", semDom);
            ILexEntry lemnop2 = MakeLexEntry("mnop", "agloss", semDom);

            var list = semDom.ReferringSenses.ToArray();

            Assert.That(list[0], Is.EqualTo(leaa.SensesOS[0]));
            Assert.That(list[1], Is.EqualTo(leabc.SensesOS[0]));
            Assert.That(list[2], Is.EqualTo(lemnop.SensesOS[0]));
            Assert.That(list[3], Is.EqualTo(lemnop2.SensesOS[0]));
            Assert.That(list[4], Is.EqualTo(lerrr.SensesOS[0]));
            Assert.That(list[5], Is.EqualTo(lezzz.SensesOS[0]));
        }
예제 #3
0
		private void EnsureFactoryForClass(string sClassName)
		{
			switch (sClassName)
			{
				case "CmPossibility":
					if (m_factPoss == null)
						m_factPoss = m_cache.ServiceLocator.GetInstance<ICmPossibilityFactory>();
					break;
				case "CmAnthroItem":
					if (m_factAnthro == null)
						m_factAnthro = m_cache.ServiceLocator.GetInstance<ICmAnthroItemFactory>();
					break;
				case "CmSemanticDomain":
					if (m_factSemDom == null)
						m_factSemDom = m_cache.ServiceLocator.GetInstance<ICmSemanticDomainFactory>();
					break;
				case "CmDomainQ":
					if (m_factCmDomainQ == null)
						m_factCmDomainQ = m_cache.ServiceLocator.GetInstance<ICmDomainQFactory>();
					break;
				case "PartOfSpeech":
					if (m_factPOS == null)
						m_factPOS = m_cache.ServiceLocator.GetInstance<IPartOfSpeechFactory>();
					break;
				default:
					// TODO: implement the other subclasses of CmPossibility.
					throw new NotImplementedException();
			}
		}
예제 #4
0
			public CmSemanticDomainCreator(ICmSemanticDomainFactory fact)
			{
				m_fact = fact;
			}
예제 #5
0
		private ICmSemanticDomain MakeNewSemDom(ICmSemanticDomainFactory semDomFact, ICmPossibilityList semDomList,
			string domainWord)
		{
			var newDomain = semDomFact.Create();
			semDomList.PossibilitiesOS.Add(newDomain);
			newDomain.Name.SetAnalysisDefaultWritingSystem(domainWord);
			m_createdObjectList.Add(newDomain);
			return newDomain;
		}
예제 #6
0
        public void RdeMerge_ExtraFields()
        {
            ICmSemanticDomainFactory factSemDom = Cache.ServiceLocator.GetInstance <ICmSemanticDomainFactory>();
            ICmSemanticDomain        semDom1    = factSemDom.Create();

            Cache.LangProject.SemanticDomainListOA.PossibilitiesOS.Add(semDom1);
            ICmSemanticDomain semDom2 = factSemDom.Create();

            Cache.LangProject.SemanticDomainListOA.PossibilitiesOS.Add(semDom2);
            ICmSemanticDomain semDom3 = factSemDom.Create();

            Cache.LangProject.SemanticDomainListOA.PossibilitiesOS.Add(semDom3);
            List <XmlNode> columns = new List <XmlNode>();

            // Create a LexEntry LE1 (cf "red" gloss "rot" in D1, with bibliographic data).
            // Attempt to merge it and verify that it survives.

            ILexEntry red = MakeLexEntry("red", "", "rot", "", semDom1);

            // After creating similar entry in another domain with same info, should merge.
            var red2 = MakeLexEntry("red", "", "rot", "", semDom2);

            red2.Bibliography.set_String(Cache.DefaultAnalWs, "found in my dictionary");
            red2.SensesOS[0].SemanticsNote.set_String(Cache.DefaultVernWs, "color of a stop light");
            red2.SensesOS[0].ScientificName = MakeAnalysisString("R=255,G=0,B=0");
            var ex1 = Cache.ServiceLocator.GetInstance <ILexExampleSentenceFactory>().Create();

            red2.SensesOS[0].ExamplesOS.Add(ex1);
            bool fSenseDeleted = RunMergeSense(columns, red2);

            Assert.IsTrue(fSenseDeleted, "Merging red/rot with matching lf/gloss should merge and delete new sense");
            Assert.IsFalse(IsRealLexEntry(red2), "Merging with red/rot with matching lf/gloss should delete entry");
            Assert.IsTrue(red.SensesOS[0].SemanticDomainsRC.Contains(semDom1), "Merging should not remove old semantic domain");
            Assert.IsTrue(red.SensesOS[0].SemanticDomainsRC.Contains(semDom2), "Merging should add new semantic domain");
            Assert.That(red.Bibliography.AnalysisDefaultWritingSystem.Text, Is.EqualTo("found in my dictionary"), "merge should copy bibliography");
            Assert.That(red.SensesOS[0].SemanticsNote.VernacularDefaultWritingSystem.Text, Is.EqualTo("color of a stop light"), "merge should copy semantics note");
            Assert.That(red.SensesOS[0].ScientificName.Text, Is.EqualTo("R=255,G=0,B=0"), "merge should copy scientific name");
            Assert.That(red.SensesOS[0].ExamplesOS, Has.Member(ex1), "merge should move example");

            // Another similar entry should merge, adding to the bibliography.
            var red3 = MakeLexEntry("red", "", "rot", "", semDom3);

            red3.Bibliography.set_String(Cache.DefaultAnalWs, "learned at mother's knee");
            red3.SensesOS[0].SemanticsNote.set_String(Cache.DefaultVernWs, "color of danger");
            red3.SensesOS[0].ScientificName = MakeAnalysisString("C=0, M=100, Y=100, K=0");
            var ex2 = Cache.ServiceLocator.GetInstance <ILexExampleSentenceFactory>().Create();

            red3.SensesOS[0].ExamplesOS.Add(ex2);
            fSenseDeleted = RunMergeSense(columns, red3);
            Assert.IsTrue(fSenseDeleted,
                          "Merging red/rot with matching lf/gloss and new defn should merge and delete new sense");
            Assert.IsFalse(IsRealLexEntry(red3), "Merging with red/rot with matching lf/gloss and new defn should delete entry");
            Assert.IsTrue(red.SensesOS[0].SemanticDomainsRC.Contains(semDom1), "Merging should not remove old semantic domain");
            Assert.IsTrue(red.SensesOS[0].SemanticDomainsRC.Contains(semDom2), "Merging should not remove old semantic domain");
            Assert.IsTrue(red.SensesOS[0].SemanticDomainsRC.Contains(semDom3), "Merging should add new semantic domain");
            Assert.That(red.Bibliography.AnalysisDefaultWritingSystem.Text, Is.EqualTo("found in my dictionary; learned at mother's knee"), "merge should append bibliography");
            Assert.That(red.SensesOS[0].SemanticsNote.VernacularDefaultWritingSystem.Text, Is.EqualTo("color of a stop light; color of danger"), "merge should append semantics note");
            Assert.That(red.SensesOS[0].ScientificName.Text, Is.EqualTo("R=255,G=0,B=0; C=0, M=100, Y=100, K=0"), "merge should append scientific name");
            Assert.That(red.SensesOS[0].ExamplesOS, Has.Member(ex1), "merge should leave original example");
            Assert.That(red.SensesOS[0].ExamplesOS, Has.Member(ex2), "merge should move second example");
        }
예제 #7
0
        public void RdeMerge_GlossAndCf()
        {
            if (Cache.LangProject.SemanticDomainListOA.PossibilitiesOS.Count < 5)
            {
                ICmSemanticDomainFactory factSemDom = Cache.ServiceLocator.GetInstance <ICmSemanticDomainFactory>();
                while (Cache.LangProject.SemanticDomainListOA.PossibilitiesOS.Count < 5)
                {
                    ICmSemanticDomain sem = factSemDom.Create();
                    Cache.LangProject.SemanticDomainListOA.PossibilitiesOS.Add(sem);
                }
            }
            IFdoOwningSequence <ICmPossibility> seqSemDom = Cache.LangProject.SemanticDomainListOA.PossibilitiesOS;
            ICmSemanticDomain semDom1 = seqSemDom[0] as ICmSemanticDomain;
            ICmSemanticDomain semDom2 = seqSemDom[1] as ICmSemanticDomain;
            ICmSemanticDomain semDom3 = seqSemDom[2] as ICmSemanticDomain;
            ICmSemanticDomain semDom4 = seqSemDom[4] as ICmSemanticDomain;

            // Create a LexEntry LE1 (cf "red" gloss "rot" in D1).
            // Attempt to merge it and verify that it survives.

            ILexEntry red      = MakeLexEntry("red", "", "rot", "", semDom1);
            Set <int> newItems = new Set <int>();
            ILexSense sense1   = red.SensesOS[0];

            newItems.Add(sense1.Hvo);
            List <XmlNode> columns       = new List <XmlNode>();
            bool           fSenseDeleted = RunMergeSense(columns, red);

            Assert.IsFalse(fSenseDeleted, "Merging red when there is no similar item should not delete sense");
            Assert.IsTrue(IsRealLexEntry(red), "Merging with no similar entry should not delete entry");
            Assert.IsTrue(red.SensesOS[0].SemanticDomainsRC.Contains(semDom1), "Merging should not remove semantic domain");

            // After creating similar entry in another domain with same info, should merge.
            var red2 = MakeLexEntry("red", "", "rot", "", semDom2);

            fSenseDeleted = RunMergeSense(columns, red2);
            Assert.IsTrue(fSenseDeleted, "Merging red/rot with matching lf/gloss should merge and delete new sense");
            Assert.IsFalse(IsRealLexEntry(red2), "Merging with red/rot with matching lf/gloss should delete entry");
            Assert.IsTrue(red.SensesOS[0].SemanticDomainsRC.Contains(semDom1), "Merging should not remove old semantic domain");
            Assert.IsTrue(red.SensesOS[0].SemanticDomainsRC.Contains(semDom2), "Merging should add new semantic domain");

            // Another similar entry should merge, adding definition.
            var red3 = MakeLexEntry("red", "", "rot", "rot2", semDom3);

            fSenseDeleted = RunMergeSense(columns, red3);
            Assert.IsTrue(fSenseDeleted, "Merging red/rot with matching lf/gloss and new defn should merge and delete new sense");
            Assert.IsFalse(IsRealLexEntry(red3), "Merging with red/rot with matching lf/gloss and new defn should delete entry");
            Assert.IsTrue(red.SensesOS[0].SemanticDomainsRC.Contains(semDom1), "Merging should not remove old semantic domain");
            Assert.IsTrue(red.SensesOS[0].SemanticDomainsRC.Contains(semDom2), "Merging should not remove old semantic domain");
            Assert.IsTrue(red.SensesOS[0].SemanticDomainsRC.Contains(semDom3), "Merging should add new semantic domain");
            Assert.That(red.SensesOS[0].Definition.AnalysisDefaultWritingSystem.Text, Is.EqualTo("rot2"));

            // Similarly we should be able to start with a matching definition, and add a gloss.
            var blue  = MakeLexEntry("blue", "", "", "blau", semDom1);
            var blue2 = MakeLexEntry("blue", "", "blauG", "blau", semDom2);

            fSenseDeleted = RunMergeSense(columns, blue2);
            Assert.IsTrue(fSenseDeleted, "Merging blue/blau with matching lf/defn and new gloss should merge and delete new sense");
            Assert.IsFalse(IsRealLexEntry(blue2), "Merging blue/blau with matching lf/defn and new gloss should delete entry");
            Assert.IsTrue(blue.SensesOS[0].SemanticDomainsRC.Contains(semDom1), "Merging should not remove old semantic domain");
            Assert.IsTrue(blue.SensesOS[0].SemanticDomainsRC.Contains(semDom2), "Merging should add new semantic domain");
            Assert.That(blue.SensesOS[0].Gloss.AnalysisDefaultWritingSystem.Text, Is.EqualTo("blauG"));

            // Conflicts in another writing system should prevent merging
            var blue3 = MakeLexEntry("blue", "", "blauG", "blau", semDom3);
            var wsEs  = Cache.WritingSystemFactory.GetWsFromStr("es");

            blue.SensesOS[0].Gloss.set_String(wsEs, "blueS");
            blue3.SensesOS[0].Gloss.set_String(wsEs, "blueS3");
            fSenseDeleted = RunMergeSense(columns, blue3);
            Assert.IsFalse(fSenseDeleted, "Merging blue/blau with matching lf/defn/gloss but different gloss in spanish should not delete sense");
            Assert.IsFalse(IsRealLexEntry(blue3), "Merging blue/blau with matching lf/defn/gloss but different gloss in spanish should delete entry");
            Assert.IsTrue(blue.SensesOS[0].SemanticDomainsRC.Contains(semDom1), "Merging should not remove old semantic domain");
            Assert.IsTrue(blue.SensesOS[0].SemanticDomainsRC.Contains(semDom2), "Merging should not remove old semantic domain");
            Assert.IsTrue(blue.SensesOS[1].SemanticDomainsRC.Contains(semDom3), "Merging should not remove old semantic domain");

            // A conflicting lex entry, even though a homograph in the current relevant writing system, should prevent merging,
            // even though the sense data all matches
            blue.CitationForm.set_String(Cache.DefaultVernWs, "blueCf");
            var blue4 = MakeLexEntry("blueForm2", "blueCf", "blauG", "blau", semDom4);

            fSenseDeleted = RunMergeSense(columns, blue4);
            Assert.IsFalse(fSenseDeleted, "Merging blueCf/blau with matching lf/defn/gloss but different lexeme form should not delete sense");
            Assert.IsTrue(IsRealLexEntry(blue4), "Merging blueCf/blau with matching lf/defn/gloss but different lexeme form should not delete entry");
            Assert.IsTrue(blue.SensesOS[0].SemanticDomainsRC.Contains(semDom1), "Merging should not remove old semantic domain");
            Assert.IsTrue(blue.SensesOS[0].SemanticDomainsRC.Contains(semDom2), "Merging should not remove old semantic domain");
            Assert.IsTrue(blue4.SensesOS[0].SemanticDomainsRC.Contains(semDom4), "Merging should not remove old semantic domain");

            // This case demonstrates that we can merge when the existing entry has no lexeme form, filling in the one we have.
            // We can also fill in other WS alternatives.
            var green  = MakeLexEntry("", "greenF", "grun", "color grun", semDom1);
            var green2 = MakeLexEntry("green", "greenF", "grun", "color grun", semDom2);

            green2.CitationForm.set_String(wsEs, "grunCfS");
            green2.LexemeFormOA.Form.set_String(wsEs, "grunS");
            fSenseDeleted = RunMergeSense(columns, green2);
            Assert.IsTrue(fSenseDeleted, "Merging green/grun with matching cf/defn/gloss and one missing LF should delete sense");
            Assert.IsFalse(IsRealLexEntry(green2), "Merging blueCf/blau with matching lf/defn/gloss but different lexeme form should not delete entry");
            Assert.IsTrue(green.SensesOS[0].SemanticDomainsRC.Contains(semDom1), "Merging should not remove old semantic domain");
            Assert.IsTrue(green.SensesOS[0].SemanticDomainsRC.Contains(semDom2), "Merging should not remove old semantic domain");
            Assert.That(green.LexemeFormOA.Form.VernacularDefaultWritingSystem.Text, Is.EqualTo("green"), "merge should fill in missing LF");
            Assert.That(green.LexemeFormOA.Form.get_String(wsEs).Text, Is.EqualTo("grunS"), "merge should fill in missing spanish LF");
            Assert.That(green.CitationForm.get_String(wsEs).Text, Is.EqualTo("grunCfS"), "merge should fill in missing spanish CF");

            // We should not merge when NO non-empty string matches.
            var brown  = MakeLexEntry("brown", "", "braun", "", semDom1);
            var brown2 = MakeLexEntry("brown", "", "", "braun color", semDom2);

            fSenseDeleted = RunMergeSense(columns, brown2);
            Assert.IsFalse(fSenseDeleted, "Merging two forms of brown with no overlap between gloss and defn should not delete sense");

            // But as a special case we can merge if definition of one matches gloss of other.
            var brown3 = MakeLexEntry("brown", "", "", "braun", semDom2);

            fSenseDeleted = RunMergeSense(columns, brown3);
            Assert.IsTrue(fSenseDeleted, "Merging two forms of brown with no gloss of one equal to defn of other should delete sense");
            Assert.IsTrue(brown.SensesOS[0].SemanticDomainsRC.Contains(semDom2), "Merging should combine semantic domains");
            Assert.That(brown.SensesOS[0].Definition.AnalysisDefaultWritingSystem.Text, Is.EqualTo("braun"), "Merging should copy definition");

            // We want to match entries that have the same LexemeForm even if they are not homographs.
            // This is possible if one of them has an empty CF in the homograph writing system.
            var orange  = MakeLexEntry("orange", "orangeCf", "orang", "", semDom1);
            var orange2 = MakeLexEntry("orange", "", "orang", "", semDom2);

            fSenseDeleted = RunMergeSense(columns, orange2);
            Assert.IsTrue(fSenseDeleted, "Merging two forms of orange with matching LF and new blank Cf should delete sense");

            var pink  = MakeLexEntry("pink", "", "rose", "", semDom1);
            var pink2 = MakeLexEntry("pink", "pinkCf", "rose", "", semDom2);

            fSenseDeleted = RunMergeSense(columns, pink2);
            Assert.IsTrue(fSenseDeleted, "Merging two forms of pink with matching LF and old blank Cf should delete sense");
            Assert.That(pink.CitationForm.VernacularDefaultWritingSystem.Text, Is.EqualTo("pinkCf"), "merge should fill in missing CF");

            // An inexact match that moves a sense should still fill in missing info on the chosen entry.
            var yellow  = MakeLexEntry("yellow", "", "flower", "", semDom1);
            var yellow2 = MakeLexEntry("yellow", "yellowCf", "floral", "", semDom2);

            fSenseDeleted = RunMergeSense(columns, yellow2);
            Assert.IsFalse(fSenseDeleted, "Merging two forms of yellow with matching LF and old blank Cf should delete sense");
            Assert.That(yellow.CitationForm.VernacularDefaultWritingSystem.Text, Is.EqualTo("yellowCf"), "merge should fill in missing CF");
        }
예제 #8
0
        public void RdeMerge()
        {
            if (Cache.LangProject.SemanticDomainListOA.PossibilitiesOS.Count < 5)
            {
                ICmSemanticDomainFactory factSemDom = Cache.ServiceLocator.GetInstance <ICmSemanticDomainFactory>();
                while (Cache.LangProject.SemanticDomainListOA.PossibilitiesOS.Count < 5)
                {
                    ICmSemanticDomain sem = factSemDom.Create();
                    Cache.LangProject.SemanticDomainListOA.PossibilitiesOS.Add(sem);
                }
            }
            IFdoOwningSequence <ICmPossibility> seqSemDom = Cache.LangProject.SemanticDomainListOA.PossibilitiesOS;
            ICmSemanticDomain semDom1 = seqSemDom[0] as ICmSemanticDomain;
            ICmSemanticDomain semDom2 = seqSemDom[1] as ICmSemanticDomain;
            ICmSemanticDomain semDom3 = seqSemDom[2] as ICmSemanticDomain;
            ICmSemanticDomain semDom4 = seqSemDom[4] as ICmSemanticDomain;

            // Create a LexEntry LE1 ("xyzTest1" defined as "xyzDefn1.1" in D1).
            // Attempt to merge it and verify that it survives.

            ILexEntry le1      = MakeLexEntry("xyzTest1", "xyzDefn1.1", semDom1);
            Set <int> newItems = new Set <int>();
            ILexSense sense1   = le1.SensesOS[0];

            newItems.Add(sense1.Hvo);
            // get an id for the 'list of senses' property (which isn't in the model)
            int fakeFlid = (int)CmObjectFields.kflidStartDummyFlids + 1;

            List <XmlNode> columns       = new List <XmlNode>();
            bool           fSenseDeleted = sense1.RDEMergeSense(semDom1.Hvo, columns, Cache, newItems);

            Assert.IsFalse(fSenseDeleted, "RDEMergeSense 1: sense should not be deleted");
            Assert.IsTrue(IsRealLexEntry(le1));
            Assert.IsTrue(le1.SensesOS[0].SemanticDomainsRC.Contains(semDom1));

            // Attempt to merge them both.
            // Verify that LE3 survives.
            // Verify that old LE1 survives and now has two senses; new sense has xyzDefn1.2.
            // Verify that LE2 is deleted and LE3 survives.
            ILexEntry le2       = MakeLexEntry("xyzTest1", "xyzDefn1.2", semDom2);
            Set <int> newItems2 = new Set <int>();
            ILexSense sense2    = le2.SensesOS[0];

            newItems2.Add(sense2.Hvo);

            ILexEntry le3    = MakeLexEntry("xyzTest3", "xyzDefn3.1", semDom2);
            ILexSense sense3 = le3.SensesOS[0];

            newItems2.Add(sense3.Hvo);

            fSenseDeleted = sense2.RDEMergeSense(semDom2.Hvo, columns, Cache, newItems2);
            Assert.IsFalse(fSenseDeleted, "RDEMergeSense 2: sense should not be deleted");
            fSenseDeleted = sense3.RDEMergeSense(semDom2.Hvo, columns, Cache, newItems2);
            Assert.IsFalse(fSenseDeleted, "RDEMergeSense 3: sense should not be deleted");
            Assert.IsTrue(IsRealLexEntry(le3));
            Assert.IsFalse(IsRealLexEntry(le2), "entry should be deleted");
            Assert.IsTrue(IsRealLexEntry(le1));
            Assert.AreEqual(2, le1.SensesOS.Count, "sense added to entry by merge");
            Assert.AreEqual(1, le3.SensesOS.Count, "should still be one sense");
            Assert.AreEqual("xyzDefn1.2", le1.SensesOS[1].Definition.AnalysisDefaultWritingSystem.Text);
            Assert.IsTrue(le1.SensesOS[1].SemanticDomainsRC.Contains(semDom2));
            Assert.IsTrue(le3.SensesOS[0].SemanticDomainsRC.Contains(semDom2));

            // Create two more entries LE4("xyzTest1/xyzDefn1.2/D3" and LE5 ("xyzTest1/xyzDefn1.3/D3").
            // Verify that the second sense of LE1 gains a domain;
            // It also gains exactly one new sense;
            // And LE4 and LE5 are both deleted.
            ILexEntry le4       = MakeLexEntry("xyzTest1", "xyzDefn1.2", semDom3);
            Set <int> newItems3 = new Set <int>();
            ILexSense sense4    = le4.SensesOS[0];

            newItems3.Add(sense4.Hvo);

            ILexEntry le5    = MakeLexEntry("xyzTest1", "xyzDefn1.3", semDom3);
            ILexSense sense5 = le5.SensesOS[0];

            newItems3.Add(sense5.Hvo);

            fSenseDeleted = sense4.RDEMergeSense(semDom3.Hvo, columns, Cache, newItems3);
            Assert.IsTrue(fSenseDeleted, "RDEMergeSense 4: sense should be deleted");
            fSenseDeleted = sense5.RDEMergeSense(semDom3.Hvo, columns, Cache, newItems3);
            Assert.IsFalse(fSenseDeleted, "RDEMergeSense 5: sense should not be deleted");
            Assert.IsTrue(IsRealLexEntry(le3));
            Assert.IsFalse(IsRealLexEntry(le4));
            Assert.IsFalse(IsRealLexEntry(le5));
            Assert.IsTrue(IsRealLexEntry(le1));
            Assert.AreEqual(3, le1.SensesOS.Count, "one sense added to entry by merge");
            Assert.AreEqual("xyzDefn1.3", le1.SensesOS[2].Definition.AnalysisDefaultWritingSystem.Text);
            Assert.IsTrue(le1.SensesOS[2].SemanticDomainsRC.Contains(semDom3));
            int[] sense2Domains = le1.SensesOS[1].SemanticDomainsRC.ToHvoArray();
            Assert.AreEqual(2, sense2Domains.Length, "got 2 semantic domains on sense 2");
            int minDom    = Math.Min(semDom2.Hvo, semDom3.Hvo);           // smaller of expected domains.
            int maxDom    = Math.Max(semDom2.Hvo, semDom3.Hvo);
            int minActual = Math.Min(sense2Domains[0], sense2Domains[1]);
            int maxActual = Math.Max(sense2Domains[0], sense2Domains[1]);

            Assert.AreEqual(minDom, minActual, "expected domains on merged sense");
            Assert.AreEqual(maxDom, maxActual, "expected domains on merged sense");

            // Try adding four senses, three for the same CF, but which doesn't pre-exist.
            // Also, the three are exact duplicates.
            ILexEntry le6       = MakeLexEntry("xyzTest6", "xyzDefn6.1", semDom4);
            Set <int> newItems4 = new Set <int>();
            ILexSense sense6    = le6.SensesOS[0];

            newItems4.Add(sense6.Hvo);

            ILexEntry le7    = MakeLexEntry("xyzTest6", "xyzDefn6.1", semDom4);
            ILexSense sense7 = le7.SensesOS[0];

            newItems4.Add(sense7.Hvo);

            ILexEntry le8    = MakeLexEntry("xyzTest6", "xyzDefn6.1", semDom4);
            ILexSense sense8 = le8.SensesOS[0];

            newItems4.Add(sense8.Hvo);

            fSenseDeleted = sense6.RDEMergeSense(semDom4.Hvo, columns, Cache, newItems4);
            Assert.IsFalse(fSenseDeleted, "RDEMergeSense 6: sense should not be deleted");
            fSenseDeleted = sense7.RDEMergeSense(semDom4.Hvo, columns, Cache, newItems4);
            Assert.IsTrue(fSenseDeleted, "RDEMergeSense 7: sense should be deleted");
            fSenseDeleted = sense8.RDEMergeSense(semDom4.Hvo, columns, Cache, newItems4);
            Assert.IsTrue(fSenseDeleted, "RDEMergeSense 8: sense should be deleted");

            Assert.IsTrue(IsRealLexEntry(le6));
            Assert.IsFalse(IsRealLexEntry(le7));
            Assert.IsFalse(IsRealLexEntry(le8));
            Assert.AreEqual(1, le6.SensesOS.Count, "one sense survives merge");
        }