public void AddDataSource_ValidFolderPath_AddsSource() { _sut.AddContent(TestContent.Location("SingleRazorFile"), "/"); Assert.That(_sut.ContentRegistrations.Count, Is.EqualTo(1)); Assert.That(_sut.ContentRegistrations[0].DataSource, Is.TypeOf <DirectoryDataSource>()); }
public void AddDataSource_BadFolderPath_Throws() { var ex = Assert.Throws <InvalidOperationException>(() => _sut.AddContent(TestContent.Location("c:\\blah\\not\\exists"), "/")); Assert.That(ex.Message, Is.EqualTo("Data source not recognised")); }
public async Task Generate_SingleRazorFile_EmbeddedCSharpExecuted() { var config = new SiteConfiguration().AddContent(TestContent.Location("SingleRazorFile"), "/"); await _sut.Generate(config); Assert.That(_output.Files["/Index.html"].AsString(), Does.Contain("Expanded Variable")); }
public async Task Generate_SingleRazorFile_AddsHtmlFileToOutput() { var config = new SiteConfiguration().AddContent(TestContent.Location("SingleRazorFile"), "/"); await _sut.Generate(config); Assert.That(_output.Files["/Index.html"], Is.Not.Null); }
public void AddDataSource_CanOverwriteTemplateSettingsUsingCallback() { _sut.AddContent(TestContent.Location("SingleRazorFile"), "/", cr => { cr.TemplateFinder = new MyRandomTemplateThing(); }); Assert.That(_sut.ContentRegistrations[0].TemplateFinder, Is.TypeOf <MyRandomTemplateThing>()); }
public async Task Generate_MultipleMarkdownFilesInNestedDirectories_AddsHtmlFilesToOutput() { var config = new SiteConfiguration().AddContent(TestContent.Location("MultipleMarkdownFilesInNestedDirectories"), "/"); await _sut.Generate(config); Assert.That(_output.Files["/Index.html"], Is.Not.Null); Assert.That(_output.Files["/inner/Index.html"], Is.Not.Null); }
public async Task Generate_SingleMarkdownFile_AddsHtmlFileToOutput() { var config = new SiteConfiguration().AddContent(TestContent.Location("SingleMarkdownFile"), "/"); await _sut.Generate(config); Assert.That(_output.Files["/Index.html"], Is.Not.Null); Assert.That(_output.Files["/Index.html"].AsString(), Does.Contain("<h1 id=\"this-is-some-text\">This is some text</h1>")); }
public async Task Generate_SingleMarkdownFileWithLocalMustacheTemplate_FrontMatterVariablesCanBeUsedInTemplate() { var config = new SiteConfiguration() .AddContent(TestContent.Location("SingleMarkdownFileWithSameDirTemplate"), "/"); await _sut.Generate(config); Assert.That(_output.Files["/Index.html"], Is.Not.Null); Assert.That(_output.Files["/Index.html"].AsString(), Does.Contain("Expanded Variable")); }
public async Task Generate_SingleMarkdownFileWithLocalMustacheTemplate_TemplatesFile() { var config = new SiteConfiguration() .AddContent(TestContent.Location("SingleMarkdownFileWithSameDirTemplate"), "/"); await _sut.Generate(config); Assert.That(_output.Files["/Index.html"], Is.Not.Null); Assert.That(_output.Files["/Index.html"].AsString(), Does.Contain("<h1>This is from the template</h1>")); Assert.That(_output.Files["/Index.html"].AsString(), Does.Contain("<h1 id=\"this-is-some-text\">This is some text</h1>")); }