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);
        }
        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
                        }
                    });
                });
            });
        }
 public CSOMTokenReplacementServiceTests()
 {
     Service = new CSOMTokenReplacementService();
     ProvisionRunner = new CSOMProvisionRunner();
 }
        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
                    });
                });
            });
        }