public void WriteExample30FromV4SpecWithModel() { this.TestInit(this.GetModel()); ODataJsonLightDeltaWriter writer = new ODataJsonLightDeltaWriter(outputContext, this.GetCustomers(), this.GetCustomerType()); writer.WriteStart(feedWithoutInfo); writer.WriteStart(customerUpdated); writer.WriteEnd(); writer.WriteDeltaDeletedLink(linkToOrder10643); writer.WriteDeltaLink(linkToOrder10645); writer.WriteStart(order10643); writer.WriteEnd(); writer.WriteDeltaDeletedEntry(customerDeleted); writer.WriteEnd(); writer.Flush(); this.TestPayload().Should().Be("{\"@odata.context\":\"http://host/service/$metadata#Customers/$delta\",\"@odata.count\":5,\"@odata.deltaLink\":\"Customers?$expand=Orders&$deltatoken=8015\",\"value\":[{\"@odata.id\":\"Customers('BOTTM')\",\"ContactName\":\"Susan Halvenstern\"},{\"@odata.context\":\"http://host/service/$metadata#Customers/$deletedLink\",\"source\":\"Customers('ALFKI')\",\"relationship\":\"Orders\",\"target\":\"Orders('10643')\"},{\"@odata.context\":\"http://host/service/$metadata#Customers/$link\",\"source\":\"Customers('BOTTM')\",\"relationship\":\"Orders\",\"target\":\"Orders('10645')\"},{\"@odata.context\":\"http://host/service/$metadata#Orders/$entity\",\"@odata.id\":\"Orders(10643)\",\"ShippingAddress\":{\"Street\":\"23 Tsawassen Blvd.\",\"City\":\"Tsawassen\",\"Region\":\"BC\",\"PostalCode\":\"T2F 8M4\"}},{\"@odata.context\":\"http://host/service/$metadata#Customers/$deletedEntity\",\"id\":\"Customers('ANTON')\",\"reason\":\"deleted\"}]}"); }
public void CannotWriteDeltaItemWhileWritingExpandedNavigationProperty() { this.TestInit(this.GetModel()); Action writeAction = () => { ODataJsonLightDeltaWriter writer = new ODataJsonLightDeltaWriter(outputContext, this.GetCustomers(), this.GetCustomerType()); writer.WriteStart(deltaFeed); writer.WriteStart(customerEntry); writer.WriteStart(ordersNavigationLink); writer.WriteStart(ordersFeed); writer.WriteDeltaDeletedEntry(customerDeleted); }; writeAction.ShouldThrow<ODataException>().WithMessage(Strings.ODataJsonLightDeltaWriter_InvalidTransitionFromExpandedNavigationProperty("ExpandedNavigationProperty", "DeltaDeletedEntry")); }