SIL.FieldWorks.IText.AddWordsToLexiconTests.PickLexGlossCreatingNewAnalysis C# (CSharp) Method

PickLexGlossCreatingNewAnalysis() private method

private PickLexGlossCreatingNewAnalysis ( ) : void
return void
		public void PickLexGlossCreatingNewAnalysis()
		{
			var cba0_0 = GetCba(0, 0, 0);
			m_sandbox.SwitchWord(cba0_0);
			ILexEntry lexEntry1_Entry;
			ILexSense lexEntry1_Sense1;
			SetupLexEntryAndSense("xxxa", "0.0.xxxa", out lexEntry1_Entry, out lexEntry1_Sense1);

			// mark the count of LexEntries
			int cEntriesOrig = Cache.LangProject.LexDbOA.Entries.Count();

			// add a new word gloss
			m_sandbox.SetTssInSandbox(InterlinLineChoices.kflidWordGloss,
				Cache.DefaultAnalWs, "0.0.xxxa");
			IWfiWordform wf = cba0_0.Analysis.Wordform;
			// set word pos, to first possibility (e.g. 'adjunct')
			int hvoSbWordPos = m_sandbox.SelectIndexInCombo(InterlinLineChoices.kflidWordPos, 0, 0);

			// confirm the analysis (making a real analysis and a LexSense)
			var wag = m_sandbox.ConfirmAnalysis();
			IWfiGloss wfiGloss = wag.Gloss;

			// make sure we didn't add entries or senses to the Lexicon.
			int cEntriesAfter = Cache.LangProject.LexDbOA.Entries.Count();
			Assert.AreEqual(cEntriesOrig, cEntriesAfter);
			Assert.AreEqual(1, lexEntry1_Entry.SensesOS.Count);

			// make sure the sense matches the existing one.
			ILexSense sense = m_sandbox.GetLexSenseForWord();
			Assert.AreEqual(lexEntry1_Sense1.Hvo, sense.Hvo);
			// make sure the morph is linked to our lexicon sense, msa, and part of speech.
			ValidateSenseWithAnalysis(sense, wfiGloss, hvoSbWordPos);

			// confirm we have created a new analysis and that it is monomorphemic
			IWfiAnalysis wfiAnalysis = wag.WfiAnalysis;
			Assert.AreEqual(wf, wag.Wordform, "Expected confirmed analysis to be owned by the original wordform.");
			Assert.AreEqual(1, wf.AnalysesOC.Count);
			Assert.AreEqual(1, wfiAnalysis.MorphBundlesOS.Count);
			Assert.AreEqual(1, wfiAnalysis.MeaningsOC.Count);
		}