Configuring the Item Access
sergeyshushlyapin edited this page Nov 4, 2014
·
1 revision
The code below denies item read, so that the GetItem() method returns null:
[Fact]
public void HowToConfigureItemAccess()
{
using (Sitecore.FakeDb.Db db = new Sitecore.FakeDb.Db
{
// set Access.CanRead to False
new Sitecore.FakeDb.DbItem("home") { Access = { CanRead = false } }
})
{
Sitecore.Data.Items.Item item = db.GetItem("/sitecore/content/home");
// item is null because read is denied
Xunit.Assert.Null(item);
}
}