public void CustomKey() { var result = SampleWithCustomKey.CreateQuery().OData().Filter("Name eq 'n1'").ToArray(); Assert.Single(result); Assert.Equal("n1", result[0].Name); }
public void ExpandWithAttributesAndExplicit() { ISelectExpandWrapper[] result = SampleWithCustomKey.CreateQuery().OData().SelectExpand("*", "AutoExpandAndSelectLink").ToArray(); IDictionary <string, object> metadata = result[0].ToDictionary(); // Not expanded by default Assert.Equal(3, metadata.Count); Assert.Equal(6, (metadata["AutoExpandAndSelectLink"] as ISelectExpandWrapper).ToDictionary().Count); }
public void ExpandMaxDeepNotExceed() { ISelectExpandWrapper[] result = SampleWithCustomKey.CreateQuery().OData().SelectExpand(null, "RecursiveLink($expand=RecursiveLink)").ToArray(); IDictionary <string, object> metadata = result[0].ToDictionary(); // Not expanded by default Assert.Equal(5, metadata.Count); Assert.NotNull(metadata["RecursiveLink"]); }
public void ExpandMaxDeepExceed() { Assert.Throws <ODataException>( () => SampleWithCustomKey.CreateQuery().OData().SelectExpand(null, "RecursiveLink($expand=RecursiveLink($expand=RecursiveLink))")); }
public void ExpandCollectionWithNotExpandable() { Assert.Throws <ODataException>( () => SampleWithCustomKey.CreateQuery().OData().SelectExpand("Id", "NotExpandableLink")); }