When using FakeDb, and I set the full path of a DbItem to go under the media library, the path gets changed to the /sitecore/content/home/image-item.
public void MediaItemPath() { Sitecore.Data.ID mediaItemId = Sitecore.Data.ID.NewID;
//Method starts here
public void MediaItemPath()
{
Sitecore.Data.ID mediaItemId = Sitecore.Data.ID.NewID;
// create some media item. Location, fields and template are not important
using (Sitecore.FakeDb.Db db = new Sitecore.FakeDb.Db())
{
var mediaFakeItem = new Sitecore.FakeDb.DbItem("my-image", mediaItemId);
mediaFakeItem.FullPath = "/sitecore/media library/my-image";
db.Add(mediaFakeItem);
Sitecore.Data.Items.Item mediaItem = db.GetItem(mediaItemId);
Assert.AreEqual("/sitecore/media library/my-image", mediaFakeItem.FullPath);
}
}
How can I add an item to the media library?