/// <summary> /// Turn on the checking (after we've made all our test fixture). /// </summary> void StartCheckingDataAccess() { m_sdaChecker = new CheckedUpdateDataAccess(Cache.MainCacheAccessor); ((NewFdoCache)Cache).DataAccess = m_sdaChecker; m_handler = new MockActionHandler(m_sdaChecker); ((NewFdoCache)Cache).ActionHandler = m_handler; }
public void CheckForInvalidMovedTextMarkerOnLoad() { int[] allParaWfics = m_helper.MakeAnnotationsUsedN(2); CmIndirectAnnotation row0 = m_helper.MakeRow1a(); CmIndirectAnnotation row1 = m_helper.MakeSecondRow(); m_helper.MakeColumnAnnotation(0, new int[] { allParaWfics[0] }, row0); CmIndirectAnnotation cca1_0 = m_helper.MakeColumnAnnotation(0, new int[] { allParaWfics[1] }, row1); CmIndirectAnnotation cca0_1 = m_helper.MakeMovedTextAnnotation(1, cca1_0, row0, "Postposed"); ConstituentChartLogic.SetFeature(Cache.MainCacheAccessor, cca1_0.Hvo, ConstituentChartLogic.MovedTextFeatureName, true); CmIndirectAnnotation ccaFoolish = m_helper.MakeMovedTextAnnotation(2, cca0_1, row0, "Preposed"); // StartCheckingDataAccess() needs a MockActionHandler that gets in the way here // because we don't want this "Undoable". m_sdaChecker = new CheckedUpdateDataAccess(Cache.MainCacheAccessor); ((NewFdoCache)Cache).DataAccess = m_sdaChecker; m_sdaChecker.AllowWrites = true; bool retFlag = m_logic.CheckForUnsetMovedTextOrInvalidMrkr(ccaFoolish.Hvo); m_sdaChecker.VerifyExpectedChanges(); AssertUsedAnnotations(allParaWfics, 2); // no change in ribbon Assert.IsFalse(retFlag, "Wrong return value: should be 'false'."); }
public void CheckForValidMarkersOnLoad() { int[] allParaWfics = m_helper.MakeAnnotationsUsedN(0); ICmIndirectAnnotation row0 = m_helper.MakeRow1a(); ICmIndirectAnnotation row1 = m_helper.MakeSecondRow(); ICmBaseAnnotation ccaLM = m_helper.MakeMarkerAnnotation(1, row0, m_helper.GetAMarker()); ICmIndirectAnnotation ccaMissing = m_helper.MakeColumnAnnotation(0, new int[0], row1); ccaMissing.Comment.SetAnalysisDefaultWritingSystem("---"); ICmIndirectAnnotation ccaClauseFeat = m_helper.MakeDependentClauseMarker(row1, 1, new int[] {row0.Hvo}, "song", "<>"); // StartCheckingDataAccess() needs a MockActionHandler that gets in the way here // because we don't want this "Undoable". m_sdaChecker = new CheckedUpdateDataAccess(Cache.MainCacheAccessor); ((NewFdoCache)Cache).DataAccess = m_sdaChecker; m_sdaChecker.AllowWrites = true; bool retFlag1 = m_logic.CheckForUnsetMovedTextOrInvalidMrkr(ccaLM.Hvo); bool retFlag2 = m_logic.CheckForUnsetMovedTextOrInvalidMrkr(ccaMissing.Hvo); bool retFlag3 = m_logic.CheckForUnsetMovedTextOrInvalidMrkr(ccaClauseFeat.Hvo); m_sdaChecker.VerifyExpectedChanges(); AssertUsedAnnotations(allParaWfics, 0); // no change in ribbon Assert.IsTrue(retFlag1, "Wrong return value: should be 'true'."); Assert.IsTrue(retFlag2, "Wrong return value: should be 'true'."); Assert.IsTrue(retFlag3, "Wrong return value: should be 'true'."); }
public void CheckMovedTextFeatureOnLoad() { int[] allParaWfics = m_helper.MakeAnnotationsUsedN(2); CmIndirectAnnotation row0 = m_helper.MakeRow1a(); CmIndirectAnnotation row1 = m_helper.MakeSecondRow(); m_helper.MakeColumnAnnotation(0, new int[] { allParaWfics[0] }, row0); CmIndirectAnnotation cca1_0 = m_helper.MakeColumnAnnotation(0, new int[] { allParaWfics[1] }, row1); CmIndirectAnnotation cca0_1 = m_helper.MakeMovedTextAnnotation(1, cca1_0, row0, "Postposed"); // StartCheckingDataAccess() needs a MockActionHandler that gets in the way here // because we don't want this "Undoable". m_sdaChecker = new CheckedUpdateDataAccess(Cache.MainCacheAccessor); ((NewFdoCache)Cache).DataAccess = m_sdaChecker; m_sdaChecker.AllowWrites = true; // Check postposed marker for unset target Feature & repair m_sdaChecker.ExpectUnicode(cca1_0.Hvo, kflidCompDetails, "<ccinfo " + ConstituentChartLogic.MovedTextFeatureName + "=\"true\"/>", "should set the 'movedText' feature"); bool retFlag = m_logic.CheckForUnsetMovedTextOrInvalidMrkr(cca0_1.Hvo); m_sdaChecker.VerifyExpectedChanges(); AssertUsedAnnotations(allParaWfics, 2); // no change in ribbon Assert.IsTrue(retFlag, "Wrong return value: should be 'true'."); }