Archive for October, 2013

Adding two usefull Shortcuts to the Sitecore startmenu

31/10/2013 Leave a comment

In my day to day work with Sitecore i often have to change Database context to either Core or Web, and using the Database selector is of course, quickly becomes irritating and cumbersome. Then you one could create  a custom command that open the content editor with the parameters “sc_lang=*Database*”. But in this post i will show how you can get the same two shortcuts without writing any code.

First you need to go to the core database, and navigate to the this folder:

“/sitecore/content/Documents and settings/All users/Start menu/Left”

Duplicate the link “Content Editor” Name it something meaningful fx. “Web Content Editor”

In the Parameters field add the following “&sc_content=web” for the web database and “&sc_content=core” for the core database. See example image below.

30-10-2013 22-46-38


Now go back to the Master database and see the two new shortcuts in the startmenu. Now with these two shortcuts it is really easy to switch between the databases

30-10-2013 22-46-09

Categories: Sitecore Tags:

Getting started with Sitecore Fakes

23/10/2013 Leave a comment

in this post I will give a simple guide that can get you started on using Sitecore Fakes. So you can start doing unit testing with Sitecore.  You can use Sitecore fakes with any testing framework for example Nunit Xunit o any like those.

1. First  you should go and download the the code from github :

2.  Once you have downloaded the code start it up in Visual Studio, and fix the missing reference for the Sitecore.Kernel.dll see image below, and then build the project. If the test project fails you can, if you like, fix the missing references for Sitecore.Kernel and Sitecore.Nexus all other references can be updated through nuget. But it is not required to get Sitecore.Fakes to work.


3. Now open the solution that holds the code you want to test and add a new “class library” to the solution. To the newly created project  you will need to add an app.config file and a references off course to the Sitecore .Fakes.dll you just build in step 2. The App.config filles is ONLY REQUIRED if you need to access anything else but the the “Item.Fields” for example the database child colletion and so on. The content for the app.config you can copy in from test project that Sitecore Fakes comes with and has on Github, but as a service i will give it here.

<?xml version="1.0"?>
 <section name="sitecore" type="Sitecore.Configuration.ConfigReader, Sitecore.Kernel"/>
 <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, Sitecore.Logging"/>
 <sitecore database="SqlServer">
 <itemManager defaultProvider="default">
 <add name="default" type="Sitecore.Fakes.FakeItemProvider,Sitecore.Fakes"/>
 <database id="web" singleInstance="true" type="Sitecore.Fakes.FakeDatabase, Sitecore.Fakes">
 <param desc="name">$(id)</param>
 <mediaProvider type="Sitecore.Fakes.FakeMediaProvider, Sitecore.Fakes"/>
 <setting name="LicenseFile" value="C:\license.xml"/>

4. Next add a reference to Sitecore kernel and Sitecore Nexus in the newly created class.
6.  Write your first test and see is Fail …. or Pass

In the future hopefully Sitecore Fakes will be available through nuget so you can skip a few of the steps above. more details aboudt Sitecore Fakes ca be found in my earlier posts here and here