コード例 #1
0
        public void CustomKey()
        {
            var result = SampleWithCustomKey.CreateQuery().OData().Filter("Name eq 'n1'").ToArray();

            Assert.Single(result);
            Assert.Equal("n1", result[0].Name);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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"]);
        }
コード例 #4
0
 public void ExpandMaxDeepExceed()
 {
     Assert.Throws <ODataException>(
         () => SampleWithCustomKey.CreateQuery().OData().SelectExpand(null, "RecursiveLink($expand=RecursiveLink($expand=RecursiveLink))"));
 }
コード例 #5
0
 public void ExpandCollectionWithNotExpandable()
 {
     Assert.Throws <ODataException>(
         () => SampleWithCustomKey.CreateQuery().OData().SelectExpand("Id", "NotExpandableLink"));
 }