Esempio n. 1
0
        public void MergeUrlParametersTest()
        {
            var mergedUrl = UrlUtility.CombineRelativeUrlWithUrlParameters("teams/{Site.GroupId}/channels", "");

            Assert.IsTrue(mergedUrl.Equals("teams/{Site.GroupId}/channels", StringComparison.InvariantCultureIgnoreCase));

            mergedUrl = UrlUtility.CombineRelativeUrlWithUrlParameters("teams/{Site.GroupId}/channels", "$select=displayName,id");
            Assert.IsTrue(mergedUrl.Equals("teams/{Site.GroupId}/channels?$select=displayName,id", StringComparison.InvariantCultureIgnoreCase));

            mergedUrl = UrlUtility.CombineRelativeUrlWithUrlParameters("teams/{Site.GroupId}/channels?$select=displayName,id", "");
            Assert.IsTrue(mergedUrl.Equals("teams/{Site.GroupId}/channels?$select=displayName,id", StringComparison.InvariantCultureIgnoreCase));

            mergedUrl = UrlUtility.CombineRelativeUrlWithUrlParameters("teams/{Site.GroupId}/installedapps?$select=bert&$expand=TeamsApp", "$select=displayName,id");
            Assert.IsTrue(mergedUrl.Equals("teams/{Site.GroupId}/installedapps?$select=bert,displayName,id&$expand=TeamsApp", StringComparison.InvariantCultureIgnoreCase));

            mergedUrl = UrlUtility.CombineRelativeUrlWithUrlParameters("teams/{Site.GroupId}/installedapps?$expand=TeamsApp", "$select=displayName,id");
            Assert.IsTrue(mergedUrl.Equals("teams/{Site.GroupId}/installedapps?$expand=TeamsApp&$select=displayname,id", StringComparison.InvariantCultureIgnoreCase));

            // Case sensitive test on list name!
            mergedUrl = UrlUtility.CombineRelativeUrlWithUrlParameters("https://bertonline.sharepoint.com/sites/prov-1/_api/web/lists", "$select=Title,ListExperienceOptions&$filter=Title%20eq%20%27Documents%27&$top=1");
            Assert.IsTrue(mergedUrl.Equals("bertonline.sharepoint.com/sites/prov-1/_api/web/lists?$select=Title,ListExperienceOptions&$filter=Title+eq+%27Documents%27&$top=1"));
        }