コード例 #1
0
        public void GetQueryString_When_Select_PrimaryId_And_HasSameEntityLookup_Then_Query_IsValid_Test()
        {
            WebApiMetadata metadata = MockedWebApiMetadata.CreateD365Ce();

            var options = QueryOptions.Select("incidentid");

            var query = options.BuildQueryString(metadata, "incident");

            query.Should().Be("?$select=incidentid");
        }
コード例 #2
0
        public void GetQueryString_When_Select_Lookup_Then_Query_IsValid_Test()
        {
            WebApiMetadata metadata = MockedWebApiMetadata.CreateD365Ce();

            var options = QueryOptions.Select("createdby", "primarycontactid");

            var query = options.BuildQueryString(metadata, "account");

            query.Should().Be("?$select=_createdby_value,_primarycontactid_value");
        }
コード例 #3
0
        public void GetQueryString_When_Create_Then_Select_Eq_PrimaryId_Test()
        {
            WebApiMetadata metadata = MockedWebApiMetadata.CreateD365Ce();

            var options = new QueryOptions();

            var query = options.BuildQueryString(metadata, "account");

            query.Should().Be("?$select=accountid");
        }
コード例 #4
0
        public void GetQueryString_When_SetAllColumns_Then_Query_Is_Empty_Test()
        {
            WebApiMetadata metadata = MockedWebApiMetadata.CreateD365Ce();

            var options = new QueryOptions()
                          .Select(new ColumnSet()
            {
                AllColumns = true
            });

            var query = options.BuildQueryString(metadata, "account");

            query.Should().Be("");
        }
コード例 #5
0
        public void GetQueryString_When_SetOrder_Then_Query_IsValid_Test()
        {
            WebApiMetadata metadata = MockedWebApiMetadata.CreateD365Ce();

            var options = new QueryOptions()
                          .Select(new ColumnSet()
            {
                AllColumns = true
            })
                          .OrderBy("createdby")
                          .OrderByDesc("name");

            var query = options.BuildQueryString(metadata, "account");

            query.Should().Be("?$orderby=_createdby_value,name%20desc");
        }
コード例 #6
0
        public void GetQueryString_When_SetPage_Then_Query_IsValid_Test()
        {
            WebApiMetadata metadata = MockedWebApiMetadata.CreateD365Ce();

            var options = new QueryOptions()
                          .Select(new ColumnSet()
            {
                AllColumns = true
            })
                          .Page(4)
                          .Top(10);

            var query = options.BuildQueryString(metadata, "account");

            WebUtility.UrlDecode(query).Should()
            .Be("?$top=10&$skiptoken=<cookie pagenumber=\"4\" />");


            //query.Should().Be("?$skiptoken=");
        }
コード例 #7
0
        public void GetQueryString_When_Expand_Lookup_Then_Query_IsValid_Test()
        {
            WebApiMetadata metadata = MockedWebApiMetadata.CreateD365Ce();

            var options = new QueryOptions()
                          .Select(new ColumnSet()
            {
                AllColumns = true
            })
                          .Expand("createdby", "domainname", "businessunitid")
                          .Expand("primarycontactid");

            var query = options.BuildQueryString(metadata, "account");


            WebUtility.UrlDecode(query).Should()
            .Be("?$expand=createdby($select=domainname,businessunitid),primarycontactid($select=contactid)");

            query.Should()
            .Be("?$expand=createdby($select%3Ddomainname,businessunitid),primarycontactid($select%3Dcontactid)");
        }