Ejemplo n.º 1
0
 public void GetUrl_preserves_dash_separated_values_that_arent_timestamps()
 {
     var contentItem = new ContentPage
     {
         StoragePath = @"/temp/foo-bar-baz-qak-foobar_baz.md",
     };
     contentItem.Permalink = ":title";
     contentItem.LoadContent(string.Empty, null, null);
     Assert.Equal("foo-bar-baz-qak-foobar_baz", contentItem.Url);
 }
Ejemplo n.º 2
0
 public void GetUrl_returns_file_name_when_no_folder()
 {
     var contentItem = new ContentPage
     {
         StoragePath = @"/foobar_baz.en-us.md",
     };
     contentItem.Permalink = ":title";
     contentItem.LoadContent(string.Empty, null, null);
     Assert.Equal("foobar_baz", contentItem.Url);
 }
Ejemplo n.º 3
0
 public void GetUrl_returns_strips_timestamp()
 {
     var contentItem = new ContentPage
     {
         StoragePath = @"/temp/2012-01-03-foobar_baz.md",
     };
     contentItem.Permalink = ":title";
     contentItem.LoadContent(string.Empty, null, null);
     Assert.Equal("foobar_baz", contentItem.Url);
 }
Ejemplo n.º 4
0
 public void GetUrl_returns_folder_and_original_value_when_no_timestamp()
 {
     var contentItem = new ContentPage
     {
         StoragePath = @"/temp/foobar_baz.md",
     };
     contentItem.Permalink = ":folder/:title";
     contentItem.LoadContent(string.Empty, null, null);
     Assert.Equal("temp/foobar_baz", contentItem.Url);
 }
Ejemplo n.º 5
0
 public void EvaluatePermalink_url_is_well_formatted(string permalink, string expectedUrl, string categories)
 {
     var page = new ContentPage
     {
         Categories = categories == null ? new List<string>() : categories.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList(),
         PublishedDate = new DateTime(2015, 03, 09),
         StoragePath = @"/temp/2015-03-09-foobar-baz.md",
         Permalink = permalink
     };
     page.LoadContent(string.Empty, null, null);
     Assert.Equal(expectedUrl, page.Url);
 }