Beispiel #1
0
        public void AttachTest()
        {
            var testAttachedObject = new TestAttachedObject();

            testAttachedObject.Attach(testDependencyObject);
            Assert.AreEqual(testAttachedObject.AssociatedObject, testDependencyObject);

            testAttachedObject.Attach(testDependencyObject); // for code coverage
            Assert.ThrowsException <InvalidOperationException>(() => testAttachedObject.Attach(null));
            testAttachedObject.Clone();                      // for code coverage
        }
Beispiel #2
0
        public void DetachTest()
        {
            var testAttachedObject = new TestAttachedObject();

            testAttachedObject.Attach(testDependencyObject);
            testAttachedObject.Detach();
            Assert.IsNull(testAttachedObject.AssociatedObject);
        }