public void GetEntityModel_XpmMetadataOnStaging_Success() { const string testEntityId = TestFixture.ArticleDcpEntityId; EntityModel entityModel = TestContentProvider.GetEntityModel(testEntityId, TestLocalization); Assert.IsNotNull(entityModel, "entityModel"); OutputJson(entityModel); Assert.AreEqual(testEntityId, entityModel.Id, "entityModel.Id"); Assert.IsNotNull(entityModel.XpmMetadata, "entityModel.XpmMetadata"); Assert.IsNotNull(entityModel.XpmPropertyMetadata, "entityModel.XpmPropertyMetadata"); object isQueryBased; Assert.IsTrue(entityModel.XpmMetadata.TryGetValue("IsQueryBased", out isQueryBased), "XpmMetadata contains 'IsQueryBased'"); Assert.AreEqual(true, isQueryBased, "IsQueryBased value"); object isRepositoryPublished; Assert.IsTrue(entityModel.XpmMetadata.TryGetValue("IsRepositoryPublished", out isRepositoryPublished), "XpmMetadata contains 'IsRepositoryPublished'"); Assert.AreEqual(true, isRepositoryPublished, "IsRepositoryPublished value"); // NOTE: boolean value must not have quotes in XPM markup (TSI-1251) string xpmMarkup = entityModel.GetXpmMarkup(TestFixture.ParentLocalization); StringAssert.Contains(xpmMarkup, "\"IsQueryBased\":true", "XPM markup"); StringAssert.Contains(xpmMarkup, "\"IsRepositoryPublished\":true", "XPM markup"); }
public void GetEntityModel_NoXpmMetadataOnLive_Success() // See TSI-1942 { const string testEntityId = TestFixture.ArticleDcpEntityId; ILocalization testLocalization = TestFixture.LegacyChildLocalization; EntityModel entityModel = TestContentProvider.GetEntityModel(testEntityId, testLocalization); Assert.IsNotNull(entityModel, "entityModel"); Assert.AreEqual(testEntityId, entityModel.Id, "entityModel.Id"); Assert.IsNull(entityModel.XpmMetadata, "entityModel.XpmMetadata"); Assert.IsNull(entityModel.XpmPropertyMetadata, "entityModel.XpmPropertyMetadata"); Assert.AreEqual(string.Empty, entityModel.GetXpmMarkup(testLocalization), "entityModel.GetXpmMarkup(testLocalization)"); }
public void GetEntityModel_InvalidId_Exception() { AssertThrowsException <DxaException>(() => TestContentProvider.GetEntityModel("666", TestLocalization)); }
public void GetEntityModel_NonExistent_Exception() { AssertThrowsException <DxaItemNotFoundException>(() => TestContentProvider.GetEntityModel("666-666", TestLocalization)); }