Exemplo n.º 1
0
        [Test] public void CloneContentRef()
        {
            Random       rnd    = new Random();
            TestResource source = new TestResource(rnd);
            ContentRef <TestResource> sourceRef = new ContentRef <TestResource>(source, "SomeTestPath");

            // Expect the Resource to be cloned
            TestResource target = source.DeepClone();

            Assert.AreEqual(source, target);
            Assert.AreNotSame(source, target);

            // Expect only the reference to be cloned
            ContentRef <TestResource> targetRef = sourceRef.DeepClone();

            Assert.AreEqual(sourceRef.Path, targetRef.Path);
            Assert.AreEqual(sourceRef.ResWeak, targetRef.ResWeak);

            // Let the source reference itself
            source.TestContentRef = source;
            Assert.AreSame(source, source.TestContentRef.ResWeak);

            // Expect the Resource to be cloned and holding a ContentRef to itself
            TestResource targetWithSelfRef = source.DeepClone();

            Assert.AreSame(targetWithSelfRef, targetWithSelfRef.TestContentRef.ResWeak);
        }
Exemplo n.º 2
0
        [Test] public void CloneResource()
        {
            TestResource resource      = CreateTestSource <TestResource>();
            TestResource resourceClone = resource.DeepClone();

            TestClone(resource, resourceClone);
        }
Exemplo n.º 3
0
        [Test] public void CloneResource()
        {
            Random       rnd    = new Random();
            TestResource source = new TestResource(rnd);
            TestResource target = source.DeepClone();

            Assert.AreEqual(source, target);
            Assert.AreNotSame(source, target);
            Assert.AreNotSame(source.TestReferenceList, target.TestReferenceList);
        }
Exemplo n.º 4
0
		[Test] public void CloneResource()
		{
			Random rnd = new Random();
			TestResource source = new TestResource(rnd);
			TestResource target = source.DeepClone();

			Assert.AreEqual(source, target);
			Assert.AreNotSame(source, target);
			Assert.AreNotSame(source.TestReferenceList, target.TestReferenceList);
		}
Exemplo n.º 5
0
		[Test] public void CloneContentRef()
		{
			Random rnd = new Random();
			TestResource source = new TestResource(rnd);
			ContentRef<TestResource> sourceRef = new ContentRef<TestResource>(source, "SomeTestPath");

			// Expect the Resource to be cloned
			TestResource target = source.DeepClone();
			Assert.AreEqual(source, target);
			Assert.AreNotSame(source, target);

			// Expect only the reference to be cloned
			ContentRef<TestResource> targetRef = sourceRef.DeepClone();
			Assert.AreEqual(sourceRef.Path, targetRef.Path);
			Assert.AreEqual(sourceRef.ResWeak, targetRef.ResWeak);

			// Let the source reference itself
			source.TestContentRef = source;
			Assert.AreSame(source, source.TestContentRef.ResWeak);

			// Expect the Resource to be cloned and holding a ContentRef to itself
			TestResource targetWithSelfRef = source.DeepClone();
			Assert.AreSame(targetWithSelfRef, targetWithSelfRef.TestContentRef.ResWeak);
		}
Exemplo n.º 6
0
        [Test] public void CloneContentRef()
        {
            TestResource resource = new TestResource {
                TestProperty = "TestString"
            };
            ContentRef <TestResource> reference = new ContentRef <TestResource>(resource, "SomeTestPath");

            // Expect the Resource to be cloned
            TestResource resourceClone = resource.DeepClone();

            Assert.AreNotSame(resource, resourceClone);
            Assert.AreEqual(resource.TestProperty, resourceClone.TestProperty);

            // Expect only the reference to be cloned
            ContentRef <TestResource> referenceClone = reference.DeepClone();

            Assert.AreEqual(reference.Path, referenceClone.Path);
            Assert.AreEqual(reference.ResWeak, referenceClone.ResWeak);
        }