Exemple #1
0
        public void DeleteText_BasicChart()
        {
            MakeFakeWfics();             // annotation hvos are stored in List m_hvoAnnot.
            MakeFakeTemplate();          // template hvos are stored in m_cols[].
            // CCA annotation hvos are stored in m_expectedCCAHvos, but should get deleted!
            // CCR annotation hvos are stored in m_expectedCCRHvos, but should get deleted!
            MakeBasicChart();
            Set <int> hvosToDelete = new Set <int>();

            using (NullProgressState state = new NullProgressState())
            {
                // SUT
                m_stText.DeleteObjectSideEffects(hvosToDelete, state);
            }
            int[] hvosActual = hvosToDelete.ToArray();
            // 10 = chartHvo, TextHvo, StTextHvo, 2XCCRHvo, 5XCCAHvo
            Assert.AreEqual(10, hvosActual.Length, "Wrong number of hvos to delete.");
            Assert.Contains(m_chart.Hvo, hvosActual, "The (empty) chart should be deleted.");
            Assert.AreEqual(
                (int)SIL.FieldWorks.FDO.CmObject.SpecialHVOValues.kHvoUnderlyingObjectDeleted,
                m_stText.Hvo, "StText is already deleted.");
            Assert.Contains(m_text.Hvo, hvosActual, "The containing Text should be deleted.");
            AssertArrayContainedInArray(m_expectedCCAHvos.ToArray(), hvosActual);
            AssertArrayContainedInArray(m_expectedCCRHvos.ToArray(), hvosActual);
        }
Exemple #2
0
        public void DeleteText_emptyChart()
        {
            Set <int> hvosToDelete = new Set <int>();

            using (NullProgressState state = new NullProgressState())
            {
                // SUT
                m_stText.DeleteObjectSideEffects(hvosToDelete, state);
            }
            int[] hvosActual = hvosToDelete.ToArray();
            Assert.AreEqual(3, hvosActual.Length, "Wrong number of hvos to delete.");
            Assert.Contains(m_chart.Hvo, hvosActual, "The (empty) chart should be deleted.");
            Assert.AreEqual(
                (int)SIL.FieldWorks.FDO.CmObject.SpecialHVOValues.kHvoUnderlyingObjectDeleted,
                m_stText.Hvo, "StText is already deleted.");
            Assert.Contains(m_text.Hvo, hvosActual, "The containing Text should be deleted.");
        }