public void HumanApprovedParserPreviouslyApprovedButNowRejectedAnalysisSurvives() { IWfiWordform theThreeLittlePigs = CheckAnalysisSize("theThreeLittlePigsTEST", 0, true); ParseResult result = null; IWfiAnalysis anal = null; UndoableUnitOfWorkHelper.Do("Undo stuff", "Redo stuff", m_actionHandler, () => { // Pig entry ILexEntry pigN = m_entryFactory.Create(); IMoStemAllomorph pigNForm = m_stemAlloFactory.Create(); pigN.AlternateFormsOS.Add(pigNForm); pigNForm.Form.VernacularDefaultWritingSystem = Cache.TsStrFactory.MakeString("pigNTEST", m_vernacularWS.Handle); IMoStemMsa pigNMsa = m_stemMsaFactory.Create(); pigN.MorphoSyntaxAnalysesOC.Add(pigNMsa); ILexSense pigNSense = Cache.ServiceLocator.GetInstance <ILexSenseFactory>().Create(); pigN.SensesOS.Add(pigNSense); // Human approved anal. Start with parser approved, but then it failed. var analFactory = Cache.ServiceLocator.GetInstance <IWfiAnalysisFactory>(); var mbFactory = Cache.ServiceLocator.GetInstance <IWfiMorphBundleFactory>(); // Only analysis: human approved, previously parser approved but no longer produced. anal = analFactory.Create(); theThreeLittlePigs.AnalysesOC.Add(anal); IWfiMorphBundle mb = mbFactory.Create(); anal.MorphBundlesOS.Add(mb); mb.MorphRA = pigNForm; mb.MsaRA = pigNMsa; HumanAgent.SetEvaluation(anal, Opinions.approves); ParserAgent.SetEvaluation(anal, Opinions.approves); CheckEvaluationSize(anal, 2, true, "anal"); CheckAnalysisSize("theThreeLittlePigsTEST", 1, true); result = new ParseResult(Enumerable.Empty <ParseAnalysis>()); }); m_filer.ProcessParse(theThreeLittlePigs, ParserPriority.Low, result); ExecuteIdleQueue(); CheckEvaluationSize(anal, 2, false, "analHvo"); Assert.IsTrue(anal.IsValidObject, "analysis should end up with one evaluation and not be deleted"); }
public void HumanHasNoopinionParserHadApprovedButNoLongerApprovesRemovesAnalysis() { IWfiWordform threeLittlePigs = CheckAnalysisSize("threeLittlePigsTEST", 0, true); ParseResult result = null; IWfiAnalysis anal = null; UndoableUnitOfWorkHelper.Do("Undo stuff", "Redo stuff", m_actionHandler, () => { // Pig entry ILexEntry pigN = m_entryFactory.Create(); IMoStemAllomorph pigNForm = m_stemAlloFactory.Create(); pigN.AlternateFormsOS.Add(pigNForm); pigNForm.Form.VernacularDefaultWritingSystem = TsStringUtils.MakeString("pigNTEST", m_vernacularWS.Handle); IMoStemMsa pigNMsa = m_stemMsaFactory.Create(); pigN.MorphoSyntaxAnalysesOC.Add(pigNMsa); ILexSense pigNSense = Cache.ServiceLocator.GetInstance <ILexSenseFactory>().Create(); pigN.SensesOS.Add(pigNSense); // Human no-opinion anal. Parser had approved, but then it failed to produce it. var analFactory = Cache.ServiceLocator.GetInstance <IWfiAnalysisFactory>(); var mbFactory = Cache.ServiceLocator.GetInstance <IWfiMorphBundleFactory>(); // Human no-opinion anal. Parser had approved, but then it failed to produce it. anal = analFactory.Create(); threeLittlePigs.AnalysesOC.Add(anal); IWfiMorphBundle mb = mbFactory.Create(); anal.MorphBundlesOS.Add(mb); mb.MorphRA = pigNForm; mb.MsaRA = pigNMsa; HumanAgent.SetEvaluation(anal, Opinions.noopinion); ParserAgent.SetEvaluation(anal, Opinions.approves); CheckEvaluationSize(anal, 1, true, "anal"); CheckAnalysisSize("threeLittlePigsTEST", 1, true); result = new ParseResult(Enumerable.Empty <ParseAnalysis>()); }); m_filer.ProcessParse(threeLittlePigs, ParserPriority.Low, result); ExecuteIdleQueue(); Assert.IsFalse(anal.IsValidObject, "analysis should end up with no evaluations and be deleted."); }