示例#1
0
        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);
        }
示例#2
0
        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);
        }