コード例 #1
0
        public void ValueWithComplexType()
        {
            var address = new Address() { Street = "TestStreet", City = "TestCity" };
            foreach (ODataFormat mimeType in mimeTypes)
            {
                string payload, contentType;
                this.WriteAndValidateContextUri(mimeType, model,
                    omWriter => omWriter.WriteProperty(this.CreateODataProperty(address, "HomeAddress")),
                    string.Format("\"{0}$metadata#{1}.Address\"", TestBaseUri, TestNameSpace), out payload, out contentType);

                this.ReadPayload(payload, contentType, model, omReader => omReader.ReadProperty());
            }
        }
コード例 #2
0
        public void CollectionOfComplexTypeIndividualProperty()
        {
            var address = new Address() { Street = "TestStreet", City = "TestCity" };
            var addresses = new Collection<Address>() { address };

            foreach (ODataFormat mimeType in mimeTypes)
            {
                string payload, contentType;
                this.WriteAndValidateContextUri(mimeType, model,
                    omWriter =>
                    {
                        var odataUriParser = new ODataUriParser(this.model, this.testServiceRootUri, new Uri(TestBaseUri + "People(1)/Addresses"));
                        omWriter.Settings.ODataUri = new ODataUri()
                        {
                            ServiceRoot = this.testServiceRootUri,
                            Path = odataUriParser.ParsePath()
                        };
                        omWriter.WriteProperty(this.CreateODataProperty(addresses, "Name"));
                    },
                    string.Format("\"{0}$metadata#People(1)/Addresses\"", TestBaseUri), out payload, out contentType);

                this.ReadPayload(payload, contentType, model, omReader => omReader.ReadProperty());
            }
        }