-
Notifications
You must be signed in to change notification settings - Fork 36
Installation
Sitecore FakeDb is available on NuGet. To install the framework:
- Create a new
Class Library
project. - Run the following command in the NuGet Package Manager Console:
PM> Install-Package Sitecore.FakeDb
- Add references to the following assemblies:
Lucene.Net.dll
Sitecore.Analytics.dll
Sitecore.Kernel.dll
Sitecore.Logging.dll
Sitecore.Nexus.dll
- Configure license.
There are several ways to configure the license:
-
Copy the
license.xml
file to the root of your tests project
That is the default license file location, so no any additional changes in theApp.config
required. -
Modify the 'LicensePath' setting in the
App.config
file
It allows to control the license file location, but requires merging theApp.config
when updating the FakeDb NuGet package. -
Add the
license.xml
as an existing file to the root of your tests project
It allows to avoid modifying theLicenseFile
setting in theApp.config
file and allows to run tests in NCrunch without configuring theAdditional files to include
setting.
Note: If using NUnit 3.x, when copying the license file to your test project root, you will need to update the LicenseFile
setting to /license.xml
in the App.config
.
Starting from Sitecore 8.2, the Database type is changed from Sitecore.Data.Database
to Sitecore.Data.DefaultDatabase
(see the Configuration file changes section for details). In the test project App.config
file, ensure the proper type is selected:
<!-- DATABASE TYPE
For Sitecore versions prior to 8.2 should be 'Sitecore.Data.Database, Sitecore.Kernel'.
For Sitecore 8.2 and later should be 'Sitecore.Data.DefaultDatabase, Sitecore.Kernel'. -->
<sc.variable name="databaseType" value="Sitecore.Data.DefaultDatabase, Sitecore.Kernel" />
https://github.com/sergeyshushlyapin/Sitecore.FakeDb/wiki/Configuration#configuring-ncrunch
To upgrade the framework run the following command in the NuGet Package Manager Console:
PM> Update-Package Sitecore.FakeDb
Important:
You should always overwrite the
App.config
file if requested. Otherwise important configuration changes might be lost.