public void DocumentDoesNotHoldReferenceToTextArea()
        {
            bool collectedTextArea = false;
            TextDocument textDocument = new TextDocument();

            TextArea textArea = new TextAreaWithGCCallback(delegate { collectedTextArea = true; });
            textArea.Document = textDocument;
            textArea = null;

            GarbageCollect();
            Assert.IsTrue(collectedTextArea);
            GC.KeepAlive(textDocument);
        }
        public void DocumentDoesNotHoldReferenceToTextArea()
        {
            bool         collectedTextArea = false;
            TextDocument textDocument      = new TextDocument();

            TextArea textArea = new TextAreaWithGCCallback(delegate { collectedTextArea = true; });

            textArea.Document = textDocument;
            textArea          = null;

            GarbageCollect();
            Assert.IsTrue(collectedTextArea);
            GC.KeepAlive(textDocument);
        }