public void ApproveAndStayPut_NewWordGloss()
{
var occurrences = SegmentServices.GetAnalysisOccurrences(m_para0_0).ToList();
m_interlinDoc.SelectOccurrence(occurrences[0]);
// create a new analysis.
var initialAnalysisTree = m_focusBox.InitialAnalysis;
m_focusBox.DoDuringUnitOfWork = () =>
WordAnalysisOrGlossServices.CreateNewAnalysisTreeGloss(initialAnalysisTree.Wordform);
var undoRedoText = new MockUndoRedoText("Undo", "Redo");
m_focusBox.ApproveAndStayPut(undoRedoText);
// expect change to the first occurrence.
Assert.AreEqual(m_focusBox.NewAnalysisTree.Gloss, occurrences[0].Analysis);
// expect the focus box to still be on the first occurrence.
Assert.AreEqual(occurrences[0], m_focusBox.SelectedOccurrence);
// test undo.
Assert.AreEqual(1, Cache.ActionHandlerAccessor.UndoableSequenceCount);
Cache.ActionHandlerAccessor.Undo();
Assert.AreEqual(initialAnalysisTree.Analysis, occurrences[0].Analysis);
// expect the focus box to still be on the first occurrence.
Assert.AreEqual(occurrences[0], m_focusBox.SelectedOccurrence);
}