Microsoft.R.Editor.Tree.EditorTree.Dispose C# (CSharp) Method

Dispose() public method

public Dispose ( ) : void
return void
        public void Dispose() {
            Dispose(true);
            GC.SuppressFinalize(this);
        }
        #endregion

Same methods

EditorTree::Dispose ( bool disposing ) : void

Usage Example

Example #1
0
        public void ConstructionTest() {
            TextBufferMock textBuffer = new TextBufferMock(string.Empty, RContentTypeDefinition.ContentType);
            var tree = new EditorTree(textBuffer, _editorShell);
            using (var editorDocument = new EditorDocumentMock(tree)) {
                using (var ob = new ROutlineRegionBuilder(editorDocument, _editorShell)) {

                    ob.EditorDocument.Should().NotBeNull();
                    ob.EditorTree.Should().NotBeNull();

                    editorDocument.DocumentClosing.GetInvocationList().Should().ContainSingle();

                    FieldInfo treeUpdateField = tree.GetType().GetField("UpdateCompleted", BindingFlags.Instance | BindingFlags.NonPublic);
                    var d = (MulticastDelegate)treeUpdateField.GetValue(tree);
                    d.GetInvocationList().Should().ContainSingle();

                    tree.Dispose();

                    editorDocument.DocumentClosing.Should().BeNull();
                    treeUpdateField.GetValue(tree).Should().BeNull();
                }
            }
        }