Thank you Juraj - excellent point! The reference was missing.
I made sure to reference all CMS DLLs and copy the same configuration to the unit test project.
However, the following problems make me wonder if I'm taking the right approach trying to unit test a part of a CMS system outside of the CMS context.
A. After referencing all DLLs and copying the config content I get the following exception:
[SystemMethods]: System events are not initialized.
You must call CMSContext.Init() before running any of your methods.
In web application, the web.config file must contain registration for the CMSApplicationModule:
<add name="CMSApplicationModule" type="CMS.CMSHelper.CMSApplicationModule, CMS.CMSHelper"/>.
B. If I try to call CMSContext.Init() in preparation to unit test my method I get the following error:
The application relative virtual path '~/' cannot be made absolute, because the path to the application is not known.
C. In conclusion I am wondering: Can I unit test code with Kentico API functions outside of the CMS web context? If the answer is yes, is there any thumb rule or instructions to follow on how I should prepare the system manually?
Thanks again!
Norm