public void LoadCategoryPropertyCollectionTest() { const string payload = @"<?xml version=""1.0"" encoding=""utf-8""?> <feed xml:base=""http://services.odata.org/OData/OData.svc/"" xmlns=""http://www.w3.org/2005/Atom"" xmlns:d=""http://docs.oasis-open.org/odata/ns/data"" xmlns:m=""http://docs.oasis-open.org/odata/ns/metadata""> <id>http://services.odata.org/OData/OData.svc//Products</id> <title type=""text"">Products</title> <updated>2012-11-15T19:29:45Z</updated> <link rel=""self"" title=""Products"" href=""Products"" /> <entry> <id>http://services.odata.org/OData/OData.svc/Suppliers(1)</id> <category term=""#ODataDemo.Product"" scheme=""http://docs.oasis-open.org/odata/ns/scheme"" /> <link rel=""edit"" title=""AnnotationTests_Product"" href=""Products(1)"" /> <title /> <updated>2012-11-15T19:29:45Z</updated> <author> <name /> </author> <content type=""application/xml""> <m:properties> <d:ID m:type=""Edm.Int32"">1</d:ID> </m:properties> </content> <d:City xmlns:e=""http://mynamespace"">Seattle</d:City> </entry> <entry> <id>http://services.odata.org/OData/OData.svc/Suppliers(2)</id> <category term=""#ODataDemo.Product"" scheme=""http://docs.oasis-open.org/odata/ns/scheme"" /> <link rel=""edit"" title=""AnnotationTests_Product"" href=""Products(2)"" /> <title /> <updated>2012-11-15T19:29:45Z</updated> <author> <name /> </author> <content type=""application/xml""> <m:properties> <d:ID m:type=""Edm.Int32"">2</d:ID> </m:properties> </content> <d:City xmlns:e=""http://mynamespace"">Tacoma</d:City> </entry> </feed>"; var context = CreateTransportLayerContext(payload); var c = new SimpleNorthwind.Category() { ID = 0 }; context.AttachTo("Categories", c); var operationResponse = context.LoadProperty(c, "Products"); var enumerator = operationResponse.GetEnumerator(); Assert.IsTrue(enumerator.MoveNext()); var product = (SimpleNorthwind.Product)enumerator.Current; Assert.IsNotNull(product); product.ID.Should().Be(1); Assert.IsTrue(enumerator.MoveNext()); var product2 = (SimpleNorthwind.Product)enumerator.Current; Assert.IsNotNull(product2); product2.ID.Should().Be(2); Assert.IsFalse(enumerator.MoveNext()); }