Rainbow Deserializer to Sitecore FakeDb

April 1, 2019

I've been enjoying working with Unicorn and Rainbow. These free tools, have made it much simpler to organize Sitecore updates by project and branch and keeps track of the changes as you make them. Combined with automated deployments, these tools save developers a lot of time.

Another great tool for development, Sitecore FakeDb, is a testing framework that makes it simple to run code in a mock Sitecore context. FakeDb comes with a deserializer for quickly seeding the mock database but it is not compatible with Rainbow's serialization format.

To bridge the gap, I created the library, Sitecore.FakeDb.RainbowDeserializer. This small library takes a list of file or folder paths and recursively deserializes Rainbow files into FakeDb items and templates. These are added to a FakeDb database through extension methods in the format:

    public Sitecore.FakeDb.Db WithSerializedFiles()
        var db = new Sitecore.FakeDb.Db();
        return db;

Source code is available on GitHub and the project is also posted to Nuget with and without dependencies.