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"); }
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"); }
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"); }
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(""); }
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"); }
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="); }
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)"); }