You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
}
}
The text was updated successfully, but these errors were encountered:
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:The text was updated successfully, but these errors were encountered: