public void MiscQueryOptionTest() { ODataProperty property = this.TestsHelper.QueryProperty("Customers(1)/Numbers?$orderby=$it&$top=1", MimeType); ODataCollectionValue collectionValue = property.Value as ODataCollectionValue; if (collectionValue != null) { ODataCollectionValue expectedValue = new ODataCollectionValue() { TypeName = "Collection(Edm.String)", Items = new[] { "012" } }; ODataValueAssertEqualHelper.AssertODataValueAreEqual(expectedValue, collectionValue); } property = this.TestsHelper.QueryProperty("Customers(1)/Numbers?$skip=1&$filter=contains($it,'a')", MimeType); collectionValue = property.Value as ODataCollectionValue; if (collectionValue != null) { ODataCollectionValue expectedValue = new ODataCollectionValue() { TypeName = "Collection(Edm.String)", Items = new[] { "ayz" } }; ODataValueAssertEqualHelper.AssertODataValueAreEqual(expectedValue, collectionValue); } }
public void BasicQueryOptionTest() { //$skip ODataProperty property = this.TestsHelper.QueryProperty("Customers(1)/Numbers?$skip=2", MimeType); ODataCollectionValue collectionValue = property.Value as ODataCollectionValue; if (collectionValue != null) { Assert.AreEqual(3, collectionValue.Items.Cast <object>().Count()); } //$top property = this.TestsHelper.QueryProperty("Customers(1)/Numbers?$top=3", MimeType); collectionValue = property.Value as ODataCollectionValue; if (collectionValue != null) { Assert.AreEqual(3, collectionValue.Items.Cast <object>().Count()); } //$orderby property = this.TestsHelper.QueryProperty("Customers(1)/Numbers?$orderby=$it", MimeType); collectionValue = property.Value as ODataCollectionValue; if (collectionValue != null) { ODataCollectionValue expectedValue = new ODataCollectionValue() { TypeName = "Collection(Edm.String)", Items = new [] { "012", "111-111-1111", "310", "ayz", "bca" } }; ODataValueAssertEqualHelper.AssertODataValueAreEqual(expectedValue, collectionValue); } //$filter property = this.TestsHelper.QueryProperty("Customers(1)/Numbers?$filter=$it eq '012'", MimeType); collectionValue = property.Value as ODataCollectionValue; if (collectionValue != null) { ODataCollectionValue expectedValue = new ODataCollectionValue() { TypeName = "Collection(Edm.String)", Items = new[] { "012" } }; ODataValueAssertEqualHelper.AssertODataValueAreEqual(expectedValue, collectionValue); } }