-
Notifications
You must be signed in to change notification settings - Fork 36
FakeDb Serialization
sergeyshushlyapin edited this page May 28, 2015
·
2 revisions
This is the extension for the FakeDb framework that allows to deserialize data in tests. Suggested and implemented by Robin Hermanussen, See more at Unit testing with Sitecore.FakeDb and deserialized data.
In order to install the FakeDb.Serialization package run the following command in the NuGet Package Manager Console:
PM> Install-Package Sitecore.FakeDb.Serialization
[Fact]
public void HowToDeserializeItem()
{
using (Sitecore.FakeDb.Db db = new Sitecore.FakeDb.Db
{
new Sitecore.FakeDb.Serialization.DsDbTemplate(
"/sitecore/templates/Sample/Sample Item"),
new Sitecore.FakeDb.Serialization.DsDbItem(
"/sitecore/content/home", true)
})
{
var home = db.GetItem("/sitecore/content/home");
Assert.Equal("Sitecore", home["Title"]);
}
}