public void Throws_Serialization_WhenPathNotFound() { ODataDeserializerContext context = new ODataDeserializerContext { Path = null }; Assert.Throws <SerializationException>(() => { IEdmFunctionImport action = ODataActionPayloadDeserializer.GetFunctionImport(context); }, "The operation cannot be completed because no ODataPath is available for the request."); }
public void Can_find_action(string actionName, string url) { IEdmModel model = GetModel(); ODataPath path = new DefaultODataPathHandler().Parse(model, url); Assert.NotNull(path); // Guard ODataDeserializerContext context = new ODataDeserializerContext { Path = path, Model = model }; IEdmFunctionImport action = ODataActionPayloadDeserializer.GetFunctionImport(context); Assert.NotNull(action); Assert.Equal(actionName, action.Name); }
public void Can_find_action_overload_using_bindingparameter_type() { IEdmModel model = GetModel(); string url = "Vehicles(8)/System.Web.Http.OData.Builder.TestModels.Car/Wash"; ODataPath path = new DefaultODataPathHandler().Parse(model, url); Assert.NotNull(path); // Guard ODataDeserializerContext context = new ODataDeserializerContext { Path = path, Model = model }; IEdmFunctionImport action = ODataActionPayloadDeserializer.GetFunctionImport(context); Assert.NotNull(action); Assert.Equal("Wash", action.Name); }