Пример #1
0
        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>());
        }
Пример #2
0
        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"));
        }
Пример #3
0
        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"));
        }
Пример #4
0
        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);
        }
Пример #5
0
        public void AddDataSource_CanOverwriteTemplateSettingsUsingCallback()
        {
            _sut.AddContent(TestContent.Location("SingleRazorFile"), "/", cr =>
            {
                cr.TemplateFinder = new MyRandomTemplateThing();
            });

            Assert.That(_sut.ContentRegistrations[0].TemplateFinder, Is.TypeOf <MyRandomTemplateThing>());
        }
Пример #6
0
        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);
        }
Пример #7
0
        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>"));
        }
Пример #8
0
        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"));
        }
Пример #9
0
        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>"));
        }