public void NewGlossExistingLexEntryAllomorphNewLexSense()
{
var cba0_0 = GetCba(0, 0, 0);
m_sandbox.SwitchWord(cba0_0);
string formLexEntry = "xxxab";
ITsString tssLexEntryForm = TsStringUtils.MakeTss(formLexEntry, Cache.DefaultVernWs);
string formAllomorph = "xxxa";
ITsString tssAllomorphForm = TsStringUtils.MakeTss(formAllomorph, Cache.DefaultVernWs);
// first create an entry with a matching allomorph that doesn't match 'verb' POS we will be selecting in the sandbox
ILexEntry lexEntry_NounPos;
ILexSense lexSense_NounPos;
SetupLexEntryAndSense("xxxab", "0.0.xxxab_NounPos", "noun", out lexEntry_NounPos, out lexSense_NounPos);
var stemFactory = Cache.ServiceLocator.GetInstance<IMoStemAllomorphFactory>();
var allomorph0 = stemFactory.Create();
lexEntry_NounPos.AlternateFormsOS.Add(allomorph0);
allomorph0.Form.set_String(TsStringUtils.GetWsAtOffset(tssAllomorphForm, 0), tssAllomorphForm);
// now create the entry we want to match, that has a 'verb' POS.
ILexEntry lexEntry1_Entry;
ILexSense lexEntry1_Sense1;
SetupLexEntryAndSense("xxxab", "0.0.xxxab_VerbPos", "verb", out lexEntry1_Entry, out lexEntry1_Sense1);
IMoStemAllomorph allomorph = stemFactory.Create();
lexEntry1_Entry.AlternateFormsOS.Add(allomorph);
allomorph.MorphTypeRA = lexEntry1_Entry.LexemeFormOA.MorphTypeRA;
allomorph.Form.set_String(TsStringUtils.GetWsAtOffset(tssAllomorphForm, 0), tssAllomorphForm);
// mark the count of LexEntries
int cEntriesOrig = Cache.LangProject.LexDbOA.Entries.Count();
// add a new word gloss
ITsString tssWordGlossInSandbox = m_sandbox.SetTssInSandbox(InterlinLineChoices.kflidWordGloss,
Cache.DefaultAnalWs, "0.0.xxxa");
IWfiWordform wf = cba0_0.Analysis.Wordform;
// set word pos to verb
int hvoSbWordPos = m_sandbox.GetComboItemHvo(InterlinLineChoices.kflidWordPos, 0, "transitive verb");
m_sandbox.SelectItemInCombo(InterlinLineChoices.kflidWordPos, 0, hvoSbWordPos);
// 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 to the Lexicon.
int cEntriesAfter = Cache.LangProject.LexDbOA.Entries.Count();
Assert.AreEqual(cEntriesOrig, cEntriesAfter);
// confirm we have only one 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);
// make sure the strings of the wfi gloss matches the strings of the lex gloss.
ValidateSenseWithAnalysis(m_sandbox.GetLexSenseForWord(), wfiGloss, hvoSbWordPos, true, allomorph);
}