public void InsertPageAfter_PageRequiresStylesheetWeDontHave_StylesheetFileCopied()
{
//we need an actual templateBookFolder to contain the stylesheet we need to see copied into the target book
using(var templateBookFolder = new TemporaryFolder("InsertPageAfter_PageRequiresStylesheetWeDontHave_StylesheetFileCopied"))
{
//just a boring simple target book
SetDom("<div class='bloom-page' id='1'></div>", "");
var targetBook = CreateBook();
//our template folder will have this stylesheet file
File.WriteAllText(templateBookFolder.Combine("foo.css"), ".dummy{width:100px}");
//we're going to reference one stylesheet that is actually available in the template folder, and one that isn't
var templatePage = MakeTemplatePageThatHasABookWithStylesheets( templateBookFolder, new [] {"foo.css","notthere.css"});
targetBook.InsertPageAfter(targetBook.GetPages().First(), templatePage);
Assert.True(File.Exists(targetBook.FolderPath.CombineForPath("foo.css")));
//Now add it again, to see if that causes problems
targetBook.InsertPageAfter(targetBook.GetPages().First(), templatePage);
//Have the template list a file it doesn't actually have
var templatePage2 = MakeTemplatePageThatHasABookWithStylesheets( templateBookFolder, new[] { "notthere.css" });
//for now, we just want it to not crash
targetBook.InsertPageAfter(targetBook.GetPages().First(), templatePage2);
}
}