public void GetPageModel_WithInheritedPageMetadata_Success() // See TSI-2844, CRQ-12170
        {
            string testPageUrlPath = TestLocalization.GetAbsoluteUrlPath(TestFixture.Tsi2844Page2RelativeUrlPath);

            Tsi2844PageModel pageModel = TestContentProvider.GetPageModel(testPageUrlPath, TestLocalization, addIncludes: false) as Tsi2844PageModel;

            Assert.IsNotNull(pageModel, "pageModel");
            OutputJson(pageModel);

            Assert.AreEqual("TSI-2844 Structure Group Metadata", pageModel.FolderMetadataTextField, "pageModel.FolderMetadataTextField");

            // Traces of the use of Extension Data to convey the Schema IDs of the ancestor Metadata Schemas
            Assert.IsNotNull(pageModel.ExtensionData, "pageModel.ExtensionData");
            string[] schemas = pageModel.ExtensionData["Schemas"] as string[];
            Assert.IsNotNull(schemas, "schemas");
            Assert.AreEqual(1, schemas.Length, "schemas.Length");
        }
Example #2
0
        public void GetPageModel_ContextExpressions_Success()
        {
            string testPageUrlPath = TestLocalization.GetAbsoluteUrlPath(TestFixture.ContextExpressionsTestPageRelativeUrlPath);

            PageModel pageModel = TestContentProvider.GetPageModel(testPageUrlPath, TestLocalization, addIncludes: false);

            Assert.IsNotNull(pageModel, "pageModel");
            OutputJson(pageModel);

            RegionModel mainRegion = pageModel.Regions["Main"];

            EntityModel[] entitiesWithExtensionData = mainRegion.Entities.Where(e => e.ExtensionData != null).ToArray();
            EntityModel[] entitiesWithCxInclude     = entitiesWithExtensionData.Where(e => e.ExtensionData.ContainsKey("CX.Include")).ToArray();
            EntityModel[] entitiesWithCxExclude     = entitiesWithExtensionData.Where(e => e.ExtensionData.ContainsKey("CX.Exclude")).ToArray();

            Assert.AreEqual(8, entitiesWithExtensionData.Length, "entitiesWithExtensionData.Length");
            Assert.AreEqual(6, entitiesWithCxInclude.Length, "entitiesWithCxInclude.Length");
            Assert.AreEqual(4, entitiesWithCxExclude.Length, "entitiesWithCxExclude.Length");
        }
        public void GetPageModel_WithInheritedEntityMetadata_Success() // See TSI-2844, TSI-3723
        {
            string testPageUrlPath = TestLocalization.GetAbsoluteUrlPath(TestFixture.Tsi2844PageRelativeUrlPath);

            PageModel pageModel = TestContentProvider.GetPageModel(testPageUrlPath, TestLocalization, addIncludes: false);

            Assert.IsNotNull(pageModel, "pageModel");
            OutputJson(pageModel);

            Tsi2844TestEntity testEntity = pageModel.Regions["Main"].Entities[0] as Tsi2844TestEntity;

            Assert.IsNotNull(testEntity, "testEntity");

            Assert.AreEqual("Tsi2844 TextValue XPM", testEntity.SingleLineText, "testEntity.SingleLineText");                                 // From Component Content
            Assert.AreEqual("Tsi2844 Metadata TextValue JAVA", testEntity.MetadataTextField, "testEntity.MetadataTextField");                 // From Component Metadata
            Assert.AreEqual("TSI-2844 Folder Metadata Text Value", testEntity.FolderMetadataTextField, "testEntity.FolderMetadataTextField"); // From Folder Metadata

            // Traces of the use of Extension Data to convey the Schema IDs of the ancestor Metadata Schemas
            Assert.IsNotNull(testEntity.ExtensionData, "testEntity.ExtensionData");
            string[] schemas = testEntity.ExtensionData["Schemas"] as string[];
            Assert.IsNotNull(schemas, "schemas");
            Assert.AreEqual(1, schemas.Length, "schemas.Length");
        }
Example #4
0
        public void GetPageModel_WithTargetGroupConditions_Success() // See TSI-2844, TSI-3010, TSI-3637
        {
            string testPageUrlPath = TestLocalization.GetAbsoluteUrlPath(TestFixture.Tsi3010PageRelativeUrlPath);

            PageModel pageModel = TestContentProvider.GetPageModel(testPageUrlPath, TestLocalization, addIncludes: false);

            Assert.IsNotNull(pageModel, "pageModel");
            OutputJson(pageModel);

            Tsi3010TestEntity testEntity = pageModel.Regions["Main"].Entities[0] as Tsi3010TestEntity;

            Assert.IsNotNull(testEntity, "testEntity");
            Assert.IsNotNull(testEntity.ExtensionData, "testEntity.ExtensionData");
            Condition[] conditions = testEntity.ExtensionData["TargetGroupConditions"] as Condition[];
            Assert.IsNotNull(conditions, "conditions");
            Assert.AreEqual(3, conditions.Length, "conditions.Count");

            CustomerCharacteristicCondition ccCondition = conditions.OfType <CustomerCharacteristicCondition>().FirstOrDefault();

            Assert.IsNotNull(ccCondition, "ccCondition");
            Assert.AreEqual("Browser", ccCondition.Name, "ccCondition.Name");
            Assert.AreEqual("Chrome", ccCondition.Value, "ccCondition.Value");
            Assert.AreEqual(ConditionOperator.StringEquals, ccCondition.Operator, "ccCondition.Operator");
            Assert.AreEqual(false, ccCondition.Negate, "ccCondition.Negate");

            TrackingKeyCondition tkCondition = conditions.OfType <TrackingKeyCondition>().FirstOrDefault();

            Assert.IsNotNull(tkCondition, "tkCondition");
            Assert.AreEqual("Top-level Keyword 1", tkCondition.TrackingKeyTitle, "tkCondition.TrackingKeyTitle");
            Assert.AreEqual(3.0, tkCondition.Value, "tkCondition.Value");
            Assert.AreEqual(ConditionOperator.Equals, tkCondition.Operator, "tkCondition.Operator");
            Assert.AreEqual(true, tkCondition.Negate, "tkCondition.Negate");

            TargetGroupCondition tgCondition = conditions.OfType <TargetGroupCondition>().FirstOrDefault();

            Assert.IsNotNull(tgCondition, "tgCondition");
        }