-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Description
I was trying to create an item from branch template, using the 2nd example from this page: https://github.com/sshushliapin/Sitecore.FakeDb/wiki/Branches
But parent.Add()
method returns null:
public void HowToCreateBranch()
{
var branchId = Sitecore.Data.ID.NewID;
var parentId = Sitecore.Data.ID.NewID;
using (var db = new Sitecore.FakeDb.Db
{
new Sitecore.FakeDb.DbItem(
"Branch Template",
branchId,
Sitecore.TemplateIDs.BranchTemplate),
new Sitecore.FakeDb.DbItem("Parent", parentId)
})
{
var parent = db.GetItem(parentId);
var child = parent.Add("Child Based on Branch", new Sitecore.Data.BranchId(branchId)); // <-- RETURNS NULL
// assert
Xunit.Assert.Equal(branchId, child.BranchId); // <-- FAILS
}
}
Metadata
Metadata
Assignees
Labels
No labels