public void CanProvisionRegionalSettings()
        {
            using (var scope = new Core.Diagnostics.PnPMonitoredScope("CanProvisionRegionalSettings"))
            {
                using (var ctx = TestCommon.CreateClientContext())
                {
                    // Load the base template which will be used for the comparison work
                    var template = new ProvisioningTemplate();

                    template.RegionalSettings = new Core.Framework.Provisioning.Model.RegionalSettings();
                    template.RegionalSettings.FirstDayOfWeek = System.DayOfWeek.Monday;
                    template.RegionalSettings.WorkDayEndHour = WorkHour.PM0700;
                    template.RegionalSettings.TimeZone = 5;
                    template.RegionalSettings.Time24 = true;

                    var parser = new TokenParser(ctx.Web, template);
                    new ObjectRegionalSettings().ProvisionObjects(ctx.Web, template, parser, new ProvisioningTemplateApplyingInformation());

                    ctx.Load(ctx.Web.RegionalSettings);
                    ctx.Load(ctx.Web.RegionalSettings.TimeZone, tz => tz.Id);
                    ctx.ExecuteQueryRetry();

                    Assert.IsTrue(ctx.Web.RegionalSettings.Time24);
                    Assert.IsTrue(ctx.Web.RegionalSettings.WorkDayEndHour == (short)WorkHour.PM0700);
                    Assert.IsTrue(ctx.Web.RegionalSettings.FirstDayOfWeek == (uint)System.DayOfWeek.Monday);
                    Assert.IsTrue(ctx.Web.RegionalSettings.TimeZone.Id == 5);
                }
            }
        }
        public void CanProvisionRegionalSettings()
        {
            using (var scope = new Core.Diagnostics.PnPMonitoredScope("CanProvisionRegionalSettings"))
            {
                using (var ctx = TestCommon.CreateClientContext())
                {
                    // Load the base template which will be used for the comparison work
                    var template = new ProvisioningTemplate();

                    template.RegionalSettings = new Core.Framework.Provisioning.Model.RegionalSettings();
                    template.RegionalSettings.FirstDayOfWeek = System.DayOfWeek.Monday;
                    template.RegionalSettings.WorkDayEndHour = WorkHour.PM0700;
                    template.RegionalSettings.TimeZone       = 5;
                    template.RegionalSettings.Time24         = true;

                    var parser = new TokenParser(ctx.Web, template);
                    new ObjectRegionalSettings().ProvisionObjects(ctx.Web, template, parser, new ProvisioningTemplateApplyingInformation());

                    ctx.Load(ctx.Web.RegionalSettings);
                    ctx.Load(ctx.Web.RegionalSettings.TimeZone, tz => tz.Id);
                    ctx.ExecuteQueryRetry();

                    Assert.IsTrue(ctx.Web.RegionalSettings.Time24);
                    Assert.IsTrue(ctx.Web.RegionalSettings.WorkDayEndHour == (short)WorkHour.PM0700);
                    Assert.IsTrue(ctx.Web.RegionalSettings.FirstDayOfWeek == (uint)System.DayOfWeek.Monday);
                    Assert.IsTrue(ctx.Web.RegionalSettings.TimeZone.Id == 5);
                }
            }
        }
Ejemplo n.º 3
0
        public void CanProvisionSupportedUILanguages()
        {
            using (var scope = new Core.Diagnostics.PnPMonitoredScope("CanProvisionSupportedUILanguages"))
            {
                using (var ctx = TestCommon.CreateClientContext())
                {
                    // Load the base template which will be used for the comparison work
                    var template = new ProvisioningTemplate();

                    template.SupportedUILanguages.Add(new SupportedUILanguage()
                    {
                        LCID = 1033
                    });                                                                           // English
                    template.SupportedUILanguages.Add(new SupportedUILanguage()
                    {
                        LCID = 1032
                    });                                                                           // Greek

                    var parser = new TokenParser(ctx.Web, template);
                    new ObjectSupportedUILanguages().ProvisionObjects(ctx.Web, template, parser, new ProvisioningTemplateApplyingInformation());

                    ctx.Load(ctx.Web, w => w.SupportedUILanguageIds);

                    ctx.ExecuteQueryRetry();

                    Assert.IsTrue(ctx.Web.SupportedUILanguageIds.Count() == 2);
                    Assert.IsTrue(ctx.Web.SupportedUILanguageIds.Any(i => i == 1033));
                    Assert.IsTrue(ctx.Web.SupportedUILanguageIds.Any(i => i == 1032));
                }
            }
        }
        public void CanProvisionAuditSettings()
        {
            using (var scope = new Core.Diagnostics.PnPMonitoredScope("CanProvisionAuditSettings"))
            {
                using (var ctx = TestCommon.CreateClientContext())
                {
                    // Load the base template which will be used for the comparison work
                    var template = new ProvisioningTemplate();

                    template.AuditSettings = new AuditSettings();
                    template.AuditSettings.AuditFlags = AuditMaskType.CheckIn;
                    template.AuditSettings.AuditLogTrimmingRetention = 5;
                    template.AuditSettings.TrimAuditLog = true;

                    var parser = new TokenParser(ctx.Web, template);
                    new ObjectAuditSettings().ProvisionObjects(ctx.Web, template, parser, new ProvisioningTemplateApplyingInformation());

                    var site = ctx.Site;

                    var auditSettings = site.Audit;
                    ctx.Load(auditSettings, af => af.AuditFlags);
                    ctx.Load(site, s => s.AuditLogTrimmingRetention, s => s.TrimAuditLog);
                    ctx.ExecuteQueryRetry();

                    Assert.IsTrue(auditSettings.AuditFlags == AuditMaskType.CheckIn);
                    Assert.IsTrue(site.AuditLogTrimmingRetention == 5);
                    Assert.IsTrue(site.TrimAuditLog = true);
                }
            }
        }
        public void CanProvisionSupportedUILanguages()
        {
            using (var scope = new Core.Diagnostics.PnPMonitoredScope("CanProvisionSupportedUILanguages"))
            {
                using (var ctx = TestCommon.CreateClientContext())
                {
                    // Load the base template which will be used for the comparison work
                    var template = new ProvisioningTemplate();

                    template.SupportedUILanguages.Add(new SupportedUILanguage() { LCID = 1033 }); // English
                    template.SupportedUILanguages.Add(new SupportedUILanguage() { LCID = 1032 }); // Greek

                    var parser = new TokenParser(ctx.Web, template);
                    new ObjectSupportedUILanguages().ProvisionObjects(ctx.Web, template, parser, new ProvisioningTemplateApplyingInformation());

                    ctx.Load(ctx.Web, w => w.SupportedUILanguageIds);

                    ctx.ExecuteQueryRetry();

                    Assert.IsTrue(ctx.Web.SupportedUILanguageIds.Count() == 2);
                    Assert.IsTrue(ctx.Web.SupportedUILanguageIds.Any(i => i == 1033));
                    Assert.IsTrue(ctx.Web.SupportedUILanguageIds.Any(i => i == 1032));
                }
            }
        }
Ejemplo n.º 6
0
        public void CanProvisionAuditSettings()
        {
            using (var scope = new Core.Diagnostics.PnPMonitoredScope("CanProvisionAuditSettings"))
            {
                using (var ctx = TestCommon.CreateClientContext())
                {
                    // Load the base template which will be used for the comparison work
                    var template = new ProvisioningTemplate();

                    template.AuditSettings            = new AuditSettings();
                    template.AuditSettings.AuditFlags = AuditMaskType.CheckIn;
                    template.AuditSettings.AuditLogTrimmingRetention = 5;
                    template.AuditSettings.TrimAuditLog = true;

                    var parser = new TokenParser(ctx.Web, template);
                    new ObjectAuditSettings().ProvisionObjects(ctx.Web, template, parser, new ProvisioningTemplateApplyingInformation());

                    var site = ctx.Site;

                    var auditSettings = site.Audit;
                    ctx.Load(auditSettings, af => af.AuditFlags);
                    ctx.Load(site, s => s.AuditLogTrimmingRetention, s => s.TrimAuditLog);
                    ctx.ExecuteQueryRetry();

                    Assert.IsTrue(auditSettings.AuditFlags == AuditMaskType.CheckIn);
                    Assert.IsTrue(site.AuditLogTrimmingRetention == 5);
                    Assert.IsTrue(site.TrimAuditLog = true);
                }
            }
        }
        public void CanCreateComposedLooks()
        {
            using (var scope = new Core.Diagnostics.PnPMonitoredScope("ComposedLookTests"))
            {
                using (var ctx = TestCommon.CreateClientContext())
                {
                    // Load the base template which will be used for the comparison work
                    var creationInfo = new ProvisioningTemplateCreationInformation(ctx.Web) { BaseTemplate = ctx.Web.GetBaseTemplate() };

                    var template = new ProvisioningTemplate();
                    template = new ObjectComposedLook().ExtractObjects(ctx.Web, template, creationInfo);
                    Assert.IsInstanceOfType(template.ComposedLook, typeof(Core.Framework.Provisioning.Model.ComposedLook));
                }
            }
        }
        public void CanExtractRegionalSettings()
        {
            using (var scope = new Core.Diagnostics.PnPMonitoredScope("CanExtractRegionalSettings"))
            {
                using (var ctx = TestCommon.CreateClientContext())
                {
                    // Load the base template which will be used for the comparison work
                    var creationInfo = new ProvisioningTemplateCreationInformation(ctx.Web) { BaseTemplate = ctx.Web.GetBaseTemplate() };

                    var template = new ProvisioningTemplate();
                    template = new ObjectRegionalSettings().ExtractObjects(ctx.Web, template, creationInfo);

                    Assert.IsNotNull(template.RegionalSettings);

                }
            }
        }
        public void CanExtractSupportedUILanguages()
        {
            using (var scope = new Core.Diagnostics.PnPMonitoredScope("CanProvisionSupportedUILanguages"))
            {
                using (var ctx = TestCommon.CreateClientContext())
                {
                    // Load the base template which will be used for the comparison work
                    var creationInfo = new ProvisioningTemplateCreationInformation(ctx.Web) { BaseTemplate = ctx.Web.GetBaseTemplate() };

                    var template = new ProvisioningTemplate();
                    template = new ObjectSupportedUILanguages().ExtractObjects(ctx.Web, template, creationInfo);

                    Assert.IsTrue(template.SupportedUILanguages.Count > 0);

                }
            }
        }
Ejemplo n.º 10
0
        public void CanExtractAuditSettings()
        {
            using (var scope = new Core.Diagnostics.PnPMonitoredScope("CanExtractAuditSettings"))
            {
                using (var ctx = TestCommon.CreateClientContext())
                {
                    // Load the base template which will be used for the comparison work
                    var creationInfo = new ProvisioningTemplateCreationInformation(ctx.Web)
                    {
                        BaseTemplate = ctx.Web.GetBaseTemplate()
                    };
                    var template = new ProvisioningTemplate();
                    template = new ObjectAuditSettings().ExtractObjects(ctx.Web, template, creationInfo);

                    Assert.IsNotNull(template.AuditSettings);
                }
            }
        }
        public void CanCreateComposedLooks()
        {
            using (var scope = new Core.Diagnostics.PnPMonitoredScope("ComposedLookTests"))
            {
                using (var ctx = TestCommon.CreateClientContext())
                {
                    // Load the base template which will be used for the comparison work
                    var creationInfo = new ProvisioningTemplateCreationInformation(ctx.Web)
                    {
                        BaseTemplate = ctx.Web.GetBaseTemplate()
                    };

                    var template = new ProvisioningTemplate();
                    template = new ObjectComposedLook().ExtractObjects(ctx.Web, template, creationInfo);
                    Assert.IsInstanceOfType(template.ComposedLook, typeof(Core.Framework.Provisioning.Model.ComposedLook));
                }
            }
        }
Ejemplo n.º 12
0
        public void CanExtractSupportedUILanguages()
        {
            using (var scope = new Core.Diagnostics.PnPMonitoredScope("CanProvisionSupportedUILanguages"))
            {
                using (var ctx = TestCommon.CreateClientContext())
                {
                    // Load the base template which will be used for the comparison work
                    var creationInfo = new ProvisioningTemplateCreationInformation(ctx.Web)
                    {
                        BaseTemplate = null
                    };

                    var template = new ProvisioningTemplate();
                    template = new ObjectSupportedUILanguages().ExtractObjects(ctx.Web, template, creationInfo);

                    Assert.IsTrue(template.SupportedUILanguages.Count > 0);
                }
            }
        }
        public void CanExtractRegionalSettings()
        {
            using (var scope = new Core.Diagnostics.PnPMonitoredScope("CanExtractRegionalSettings"))
            {
                using (var ctx = TestCommon.CreateClientContext())
                {
                    // Load the base template which will be used for the comparison work
                    // do not set the base template as that will mean that regional settings are not extracted
                    // when the test site has the same regional settings as the base template had
                    var creationInfo = new ProvisioningTemplateCreationInformation(ctx.Web) { BaseTemplate = null };

                    var template = new ProvisioningTemplate();
                    template = new ObjectRegionalSettings().ExtractObjects(ctx.Web, template, creationInfo);

                    Assert.IsNotNull(template.RegionalSettings);

                }
            }
        }
        public void CanExtractRegionalSettings()
        {
            using (var scope = new Core.Diagnostics.PnPMonitoredScope("CanExtractRegionalSettings"))
            {
                using (var ctx = TestCommon.CreateClientContext())
                {
                    // Load the base template which will be used for the comparison work
                    // do not set the base template as that will mean that regional settings are not extracted
                    // when the test site has the same regional settings as the base template had
                    var creationInfo = new ProvisioningTemplateCreationInformation(ctx.Web)
                    {
                        BaseTemplate = null
                    };

                    var template = new ProvisioningTemplate();
                    template = new ObjectRegionalSettings().ExtractObjects(ctx.Web, template, creationInfo);

                    Assert.IsNotNull(template.RegionalSettings);
                }
            }
        }