public void GetUrl_preserves_dash_separated_values_that_arent_timestamps() { var fmPermalink = new FrontMatterPermalink(":title") { FilePath = @"/temp/foo-bar-baz-qak-foobar_baz.md", }; var url = fmPermalink.ToUrl(); Assert.Equal("foo-bar-baz-qak-foobar_baz", url); }
public void GetUrl_returns_file_name_when_no_folder() { var fmPermalink = new FrontMatterPermalink(":title") { FilePath = @"/foobar_baz.en-us.md", }; var url = fmPermalink.ToUrl(); Assert.Equal("foobar_baz", url); }
public void GetUrl_returns_strips_timestamp() { var fmPermalink = new FrontMatterPermalink(":title") { FilePath = @"/temp/2012-01-03-foobar_baz.md", }; var url = fmPermalink.ToUrl(); Assert.Equal("foobar_baz", url); }
public void GetUrl_returns_folder_and_original_value_when_no_timestamp() { var fmPermalink = new FrontMatterPermalink(":folder/:title") { FilePath = @"/temp/foobar_baz.md", }; var url = fmPermalink.ToUrl(); Assert.Equal("temp/foobar_baz", url); }
public void EvaluatePermalink_url_is_well_formatted(string permalink, string expectedUrl, string categories) { var fmPermalink = new FrontMatterPermalink(permalink) { Categories = categories == null ? new List <string>() : categories.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList(), Date = new DateTime(2015, 03, 09), FilePath = @"/temp/2015-03-09-foobar-baz.md", }; var url = fmPermalink.ToUrl(); Assert.Equal(expectedUrl, url); }