When I try to access a template in the files/templates folder, however, I get the following error:
System.ArgumentNullException : Value cannot be null.
Parameter name: str
Parameter name: str
at System.Security.Permissions.FileIOPermission.HasIllegalCharacters(String[] str)
at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String path)
at System.Web.InternalSecurityPermissions.PathDiscovery(String path)
at System.Web.HttpRequest.MapPath(VirtualPath virtualPath, VirtualPath baseVirtualDir, Boolean allowCrossAppMapping)
at System.Web.HttpRequest.MapPath(VirtualPath virtualPath)
at System.Web.HttpServerUtility.MapPath(String path)
at Dynamicweb.Templatev2.Template.LoadTemplate(String Path)
at Dynamicweb.Templatev2.Template..ctor(String Path)
at (my class where Template template = new Template("MyTemplate.html"); is called
I'm guessing that this is because I am trying to access the template outside of a browser, resulting in the test not having the http context that the DynamicWeb template system expects.
Is there any way to create some sort of virtual http context or another way of utilising the DynamicWeb templates in unit tests?
at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String path)
at System.Web.InternalSecurityPermissions.PathDiscovery(String path)
at System.Web.HttpRequest.MapPath(VirtualPath virtualPath, VirtualPath baseVirtualDir, Boolean allowCrossAppMapping)
at System.Web.HttpRequest.MapPath(VirtualPath virtualPath)
at System.Web.HttpServerUtility.MapPath(String path)
at Dynamicweb.Templatev2.Template.LoadTemplate(String Path)
at Dynamicweb.Templatev2.Template..ctor(String Path)
at (my class where Template template = new Template("MyTemplate.html"); is called
I'm guessing that this is because I am trying to access the template outside of a browser, resulting in the test not having the http context that the DynamicWeb template system expects.
Is there any way to create some sort of virtual http context or another way of utilising the DynamicWeb templates in unit tests?