コード例 #1
0
        public void CSOMTokenReplacementService_Can_Replace_Site_Token()
        {
            var isValid = true;
            var runner = new CSOMProvisionRunner();

            runner.SiteUrls.ForEach(siteUrl =>
            {
                runner.WithCSOMContext(siteUrl, context =>
                {
                    PreloadProperties(context);

                    var web = context.Web;

                    if (web.ServerRelativeUrl == "/")
                    {
                        isValid &= CheckRootWebOnHost(context);
                    }
                    else
                    {
                        isValid &= CheckSubWebOnHost(context, web.ServerRelativeUrl);
                    }
                });
            });

            Assert.IsTrue(isValid);
        }
コード例 #2
0
        public void CSOMTokenReplacementService_Should_Support_WebModelHost()
        {
            var runner = new CSOMProvisionRunner();

            runner.SiteUrls.ForEach(siteUrl =>
            {
                runner.WithCSOMContext(siteUrl, context =>
                {
                    PreloadProperties(context);

                    var valueResult = Service.ReplaceTokens(new TokenReplacementContext
                    {
                        Value = "~site",
                        Context = new WebModelHost
                        {
                            HostClientContext = context,

                            HostSite = context.Site,
                            HostWeb = context.Web
                        }
                    });
                });
            });
        }
コード例 #3
0
 public CSOMTokenReplacementServiceTests()
 {
     Service = new CSOMTokenReplacementService();
     ProvisionRunner = new CSOMProvisionRunner();
 }
コード例 #4
0
        public void CSOMTokenReplacementService_Should_Support_ClientContext()
        {
            if (!CSOMTokenReplacementService.AllowClientContextAsTokenReplacementContext)
                return;

            var runner = new CSOMProvisionRunner();

            runner.SiteUrls.ForEach(siteUrl =>
            {
                runner.WithCSOMContext(siteUrl, context =>
                {
                    PreloadProperties(context);

                    var valueResult = Service.ReplaceTokens(new TokenReplacementContext
                    {
                        Value = "~site",
                        Context = context
                    });
                });
            });
        }