コード例 #1
0
        public void ReplaceItemReferences_ItemPassed_ShouldReplaceContentPath(ItemReferenceReplacer referenceReplacer, Db db, [Content] Item source, [Content] Item target)
        {
            var initialValue  = source.Paths.ContentPath;
            var expectedValue = target.Paths.ContentPath;

            ReplaceItemReferences_ItemPassed_ShouldReplaceValue(referenceReplacer, db, source, target, initialValue, expectedValue);
        }
コード例 #2
0
        public void ReplaceItemReferences_ItemPassed_ShouldReplaceID(ItemReferenceReplacer referenceReplacer, Db db, [Content] Item source, [Content] Item target)
        {
            var initialValue  = source.ID.ToString();
            var expectedValue = target.ID.ToString();

            ReplaceItemReferences_ItemPassed_ShouldReplaceValue(referenceReplacer, db, source, target, initialValue, expectedValue);
        }
コード例 #3
0
        private static void ReplaceItemReferences_ItemPassed_ShouldReplaceValue(ItemReferenceReplacer referenceReplacer, Db db, Item source, Item target, string initialValue, string expectedValue)
        {
            referenceReplacer.AddItemPair(source, target);

            db.Add(new DbItem("testItem")
            {
                {
                    "targetField", initialValue
                }
            });
            var item = db.GetItem("/sitecore/content/testItem");

            referenceReplacer.ReplaceItemReferences(item);
            item["targetField"].Should().Be(expectedValue);
        }