Skip to content

creating an item under system

sergeyshushlyapin edited this page Nov 4, 2014 · 2 revisions

The code below sets ParentID explicitely:

[Fact]
public void HowToCreateItemUnderSystem()
{
  using (Sitecore.FakeDb.Db db = new Sitecore.FakeDb.Db
    {
      new Sitecore.FakeDb.DbItem("Home")
        {
          ParentID = Sitecore.ItemIDs.SystemRoot
        }
    })
  {
    Sitecore.Data.Items.Item home = db.GetItem("/sitecore/system/home");
    Xunit.Assert.Equal("home", home.Key);
  }
}
Clone this wiki locally