private string WriteAndVerifyOrderFeed(StreamResponseMessage responseMessage, ODataWriter odataWriter, bool hasModel, string mimeType) { var orderFeed = new ODataFeed() { Id = new Uri(this.ServiceUri + "Order"), NextPageLink = new Uri(this.ServiceUri + "Order?$skiptoken=-9"), }; if (!hasModel) { orderFeed.SetSerializationInfo(new ODataFeedAndEntrySerializationInfo() { NavigationSourceName = "Order", NavigationSourceEntityTypeName = NameSpace + "Order" }); } odataWriter.WriteStart(orderFeed); var orderEntry1 = WritePayloadHelper.CreateOrderEntry1(hasModel); odataWriter.WriteStart(orderEntry1); var orderEntry1Navigation1 = new ODataNavigationLink() { Name = "Customer", IsCollection = false, Url = new Uri(this.ServiceUri + "Order(-10)/Customer") }; odataWriter.WriteStart(orderEntry1Navigation1); odataWriter.WriteEnd(); var orderEntry1Navigation2 = new ODataNavigationLink() { Name = "Login", IsCollection = false, Url = new Uri(this.ServiceUri + "Order(-10)/Login") }; odataWriter.WriteStart(orderEntry1Navigation2); odataWriter.WriteEnd(); // Finish writing orderEntry1. odataWriter.WriteEnd(); var orderEntry2 = WritePayloadHelper.CreateOrderEntry2(hasModel); odataWriter.WriteStart(orderEntry2); var orderEntry2Navigation1 = new ODataNavigationLink() { Name = "Customer", IsCollection = false, Url = new Uri(this.ServiceUri + "Order(-9)/Customer") }; odataWriter.WriteStart(orderEntry2Navigation1); odataWriter.WriteEnd(); var orderEntry2Navigation2 = new ODataNavigationLink() { Name = "Login", IsCollection = false, Url = new Uri(this.ServiceUri + "Order(-9)/Login") }; odataWriter.WriteStart(orderEntry2Navigation2); odataWriter.WriteEnd(); // Finish writing orderEntry2. odataWriter.WriteEnd(); // Finish writing the feed. odataWriter.WriteEnd(); // Some very basic verification for the payload. bool verifyFeedCalled = false; bool verifyEntryCalled = false; bool verifyNavigationCalled = false; Action <ODataFeed> verifyFeed = (feed) => { Assert.IsNotNull(feed.NextPageLink, "feed.NextPageLink"); verifyFeedCalled = true; }; Action <ODataEntry> verifyEntry = (entry) => { Assert.AreEqual(3, entry.Properties.Count(), "entry.Properties.Count"); verifyEntryCalled = true; }; Action <ODataNavigationLink> verifyNavigation = (navigation) => { Assert.IsTrue(navigation.Name == "Customer" || navigation.Name == "Login", "navigation.Name"); verifyNavigationCalled = true; }; Stream stream = responseMessage.GetStream(); if (!mimeType.Contains(MimeTypes.ODataParameterNoMetadata)) { stream.Seek(0, SeekOrigin.Begin); WritePayloadHelper.ReadAndVerifyFeedEntryMessage(true, responseMessage, WritePayloadHelper.OrderSet, WritePayloadHelper.OrderType, verifyFeed, verifyEntry, verifyNavigation); Assert.IsTrue(verifyFeedCalled && verifyEntryCalled && verifyNavigationCalled, "Verification action not called."); } return(WritePayloadHelper.ReadStreamContent(stream)); }