예제 #1
0
        [Test] public void GetContentRefs()
        {
            DataObject   dataIn = new DataObject();
            TestResource res    = new TestResource();
            ContentRef <TestResource> contentRef = new ContentRef <TestResource>(res);

            dataIn.SetContentRefs(new IContentRef[] { contentRef });

            Assert.IsTrue(dataIn.ContainsContentRefs());
            Assert.IsTrue(dataIn.ContainsContentRefs(typeof(TestResource)));
            Assert.AreEqual(contentRef, dataIn.GetContentRefs()[0]);
            Assert.AreEqual(contentRef, dataIn.GetContentRefs(typeof(TestResource))[0]);

            DataObject dataOut = this.SimulateClipboardSerialize(dataIn);

            Assert.IsTrue(dataOut.ContainsContentRefs());

            // This is false due to the fact that the reference to the locally created
            // TestResource will not survive serialization.
            Assert.IsFalse(dataOut.ContainsContentRefs(typeof(TestResource)));
        }