예제 #1
0
        public void RRegionBuilder_ConstructionTest()
        {
            TextBufferMock     textBuffer     = new TextBufferMock(string.Empty, RContentTypeDefinition.ContentType);
            EditorTree         tree           = new EditorTree(textBuffer);
            EditorDocumentMock editorDocument = new EditorDocumentMock(tree);

            ROutlineRegionBuilder ob = new ROutlineRegionBuilder(editorDocument);

            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();

            ob.Dispose();

            editorDocument.DocumentClosing.Should().BeNull();
            treeUpdateField.GetValue(tree).Should().BeNull();
        }
예제 #2
0
        public void ConstructionTest()
        {
            var textBuffer = new TextBufferMock(string.Empty, RContentTypeDefinition.ContentType);
            var eb         = textBuffer.ToEditorBuffer();
            var tree       = new EditorTree(eb, _services);

            using (var editorDocument = new EditorDocumentMock(tree)) {
                using (var ob = new ROutlineRegionBuilder(editorDocument, _services)) {
                    ob.EditorDocument.Should().NotBeNull();
                    ob.EditorTree.Should().NotBeNull();

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

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

                    tree.Dispose();

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