public void ODataContext_Throws_ArgumentException_ForNullScheme() { ArgumentException exception = Assert.Throws <ArgumentException>( () => ODataUtility.ODataContext(ODataMetadataLevel.Minimal, null, "services.odata.org", "/OData/Products")); Assert.Equal("Scheme must be specified (Parameter 'scheme')", exception.Message); Assert.Equal("scheme", exception.ParamName); }
public void ODataContext_Throws_ArgumentException_ForNullHost() { ArgumentException exception = Assert.Throws <ArgumentException>( () => ODataUtility.ODataContext(ODataMetadataLevel.Minimal, "https", null, "/OData/Products")); Assert.Equal("Host must be specified (Parameter 'host')", exception.Message); Assert.Equal("host", exception.ParamName); }
public void ODataContext_Throws_ArgumentException_ForNullPath() { ArgumentException exception = Assert.Throws <ArgumentException>( () => ODataUtility.ODataContext(ODataMetadataLevel.Minimal, "https", "services.odata.org", null)); Assert.Equal("Path must be specified (Parameter 'path')", exception.Message); Assert.Equal("path", exception.ParamName); }
public void ODataContext() { Assert.Equal( "https://services.odata.org/OData/$metadata", ODataUtility.ODataContext(ODataMetadataLevel.Full, "https", "services.odata.org", "/OData/Products")); Assert.Equal( "https://services.odata.org/OData/$metadata", ODataUtility.ODataContext(ODataMetadataLevel.Minimal, "https", "services.odata.org", "/OData/Products")); Assert.Equal( "https://services.odata.org/OData/$metadata", ODataUtility.ODataContext(ODataMetadataLevel.Minimal, "https", "services.odata.org", "/OData/Products/")); Assert.Equal( "https://services.odata.org/OData/$metadata", ODataUtility.ODataContext(ODataMetadataLevel.Minimal, "https", "services.odata.org", "/OData/Products(1)")); Assert.Equal( "https://services.odata.org/OData/$metadata", ODataUtility.ODataContext(ODataMetadataLevel.Minimal, "https", "services.odata.org", "/OData/Products(1)/Name")); Assert.Equal( "https://services.odata.org/OData/$metadata", ODataUtility.ODataContext(ODataMetadataLevel.Minimal, "https", "services.odata.org", "/OData/Products(1)/Name/$value")); Assert.Equal( "https://services.odata.org/OData/$metadata", ODataUtility.ODataContext(ODataMetadataLevel.Minimal, "https", "services.odata.org", "/OData/Products%281%29")); Assert.Equal( "https://services.odata.org/OData/$metadata", ODataUtility.ODataContext(ODataMetadataLevel.Minimal, "https", "services.odata.org", "/OData/Products?$select=Name")); Assert.Equal( "https://services.odata.org/OData/$metadata", ODataUtility.ODataContext(ODataMetadataLevel.Minimal, "https", "services.odata.org", "/OData/Products/?$select=Name")); Assert.Null(ODataUtility.ODataContext(ODataMetadataLevel.None, "https", "services.odata.org", "/OData/Products")); }