Пример #1
0
        public void TestResolveBackReferenceInEnumerable()
        {
            Product toaster = new Product {Name = "toaster"};
            Shop shop = new Shop {Products = {toaster}};

            ObjectGraph graph = new ObjectGraph(shop);
            object backReference = graph.ResolveBackReference(toaster);
            Assert.IsTrue(Object.ReferenceEquals(backReference, shop));
        }
Пример #2
-1
        public void TestResolveBackReference()
        {
            Owner owner = new Owner {Name = "Arthur Dent"};
            Shop shop = new Shop {Owner = owner};

            ObjectGraph graph = new ObjectGraph(shop);
            object backReference = graph.ResolveBackReference(owner);
            Assert.IsTrue(Object.ReferenceEquals(backReference, shop));
        }