-
Notifications
You must be signed in to change notification settings - Fork 36
Mocking the IDTable
sergeyshushlyapin edited this page Dec 31, 2014
·
2 revisions
[Fact]
public void HowToMockIdTable()
{
// arrange
var id = Sitecore.Data.ID.NewID;
var parentId = Sitecore.Data.ID.NewID;
var data = "{ }";
var provider = Substitute.For<Sitecore.Data.IDTables.IDTableProvider>();
using (new Sitecore.FakeDb.Data.IDTables.IDTableProviderSwitcher(provider))
{
// act
var actualEntry
= Sitecore.Data.IDTables.IDTable.Add("pref", "key", id, parentId, data);
// assert
Xunit.Assert.Equal("pref", actualEntry.Prefix);
Xunit.Assert.Equal("key", actualEntry.Key);
Xunit.Assert.Equal(id, actualEntry.ID);
Xunit.Assert.Equal(parentId, actualEntry.ParentID);
Xunit.Assert.Equal(data, actualEntry.CustomData);
}
}