SIL.FieldWorks.IText.TestTaggingChild.CallDeleteTextTags C# (CSharp) Method

CallDeleteTextTags() private method

private CallDeleteTextTags ( Set tagsToDelete ) : void
tagsToDelete Set
return void
		internal void CallDeleteTextTags(Set<ITextTag> tagsToDelete)
		{
			DeleteTextTags(tagsToDelete);
		}

Usage Example

コード例 #1
0
        public void DeleteTagAnnot_SetOfTwo()
        {
            var tagsToDelete = new Set <ITextTag>();

            // Setup the SelectedWordforms property for first tag
            var tempList = new List <AnalysisOccurrence> {
                m_occurrences[0], m_occurrences[1]
            };

            m_tagChild.SelectedWordforms = tempList;

            var hvoTag1 = -1;

            UndoableUnitOfWorkHelper.Do("UndoTagTest", "RedoTagTest", Cache.ActionHandlerAccessor, () =>
            {
                var firstTag = m_tagChild.CallMakeTextTagInstance(m_possTags[0]);
                if (firstTag != null)
                {
                    hvoTag1 = firstTag.Hvo;
                    tagsToDelete.Add(firstTag);
                }
            });

            // Setup the SelectedWordforms property for second tag
            tempList = new List <AnalysisOccurrence> {
                m_occurrences[2], m_occurrences[3], m_occurrences[4]
            };
            m_tagChild.SelectedWordforms = tempList;

            var hvoTag2 = -1;

            UndoableUnitOfWorkHelper.Do("UndoTagTest", "RedoTagTest", Cache.ActionHandlerAccessor, () =>
            {
                var secondTag = m_tagChild.CallMakeTextTagInstance(m_possTags[1]);
                if (secondTag != null)
                {
                    hvoTag2 = secondTag.Hvo;
                    tagsToDelete.Add(secondTag);
                }
            });

            // SUT
            UndoableUnitOfWorkHelper.Do("UndoTagTest", "RedoTagTest", Cache.ActionHandlerAccessor,
                                        () => m_tagChild.CallDeleteTextTags(tagsToDelete));

            // Verification
            // The two tags should no longer exist in the Cache
            AssertTagDoesntExist(hvoTag1, "Should have deleted the first tag.");
            AssertTagDoesntExist(hvoTag2, "Should have deleted the second tag.");
        }