public void AnnotationOnFeedTargetingSomethingOtherThanFeedShouldThrow() { const string payload = @" <feed 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""> <m:count>14</m:count> <m:annotation term=""custom.namespace.FeedName"" target=""something"" string=""MyFeed"" /> <id>myFeed</id> <title/> <updated>2013-01-04T21:32:48Z</updated> <author> <name/> </author> <link rel=""next"" href=""http://next.link/""/> </feed> "; Action testSubject = () => this.ReadFeedPayload(payload, reader => { }); testSubject.ShouldThrow <ODataException>().WithMessage(ODataErrorStrings.ODataAtomEntryAndFeedDeserializer_AnnotationWithNonDotTarget("something", "custom.namespace.FeedName")); }
public void AnnotationOnEntryTargetingSomethingOtherThanEntryShouldThrow() { const string payload = @" <entry 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/> <title/> <m:annotation term=""my.namespace.term"" target=""PropertyName"" m:type=""Edm.Int32"">42</m:annotation> <updated>2013-01-22T01:09:20Z</updated> <author> <name/> </author> <content type=""application/xml""> <m:properties> <d:PropertyName>PropertyValue</d:PropertyName> </m:properties> </content> </entry> "; Action testSubject = () => this.ReadEntryPayload(payload, reader => { }); testSubject.ShouldThrow <ODataException>().WithMessage(ODataErrorStrings.ODataAtomEntryAndFeedDeserializer_AnnotationWithNonDotTarget("PropertyName", "my.namespace.term")); }