Skip to content

Instantly share code, notes, and snippets.

@emiaj
Created March 18, 2011 13:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emiaj/876057 to your computer and use it in GitHub Desktop.
Save emiaj/876057 to your computer and use it in GitHub Desktop.
public class SubViewFolderTester
{
[Test]
public void create_subviewfolder()
{
var settings = new SparkSettings();
var folderSettings = new Dictionary<string, string>
{
{"virtualBaseDir", "~/Masters"},
{"subfolder", "layouts"}
};
settings.AddViewFolder(ViewFolderType.VirtualPathProvider, folderSettings);
var factory = new SparkViewFactory(settings);
var viewFolder =(CombinedViewFolder) factory.ViewFolder;
Assert.IsInstanceOf(typeof(FileSystemViewFolder), viewFolder.First); // Pass
Assert.IsInstanceOf(typeof(SubViewFolder), viewFolder.Second); // Fails, is of VirtualPathProviderViewFolder type
}
[Test]
public void create_subviewfolder_using_hack()
{
var settings = new SparkSettings();
var folderSettings = new Dictionary<string, string>
{
{"virtualBaseDir", "~/Masters"},
};
settings.AddViewFolder(ViewFolderType.VirtualPathProvider, folderSettings);
settings.ViewFolders.Last().Subfolder = "layouts";
var factory = new SparkViewFactory(settings);
var viewFolder = (CombinedViewFolder)factory.ViewFolder;
Assert.IsInstanceOf(typeof(FileSystemViewFolder), viewFolder.First); // Pass
Assert.IsInstanceOf(typeof(SubViewFolder), viewFolder.Second); // Pass
}
}
@emiaj
Copy link
Author

emiaj commented Mar 18, 2011

I've run the tests against the spark.web.mvc version and got the same results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment