public void BlogCategory() { var category = new CategoryModel { Id = 1, Title = "Test Category", Slug = "test-category" }; var mocks = new Mocks(); Assert.AreEqual("/blog/category/test-category", BlogUrlHelperExtensions.BlogCategory(mocks.UrlHelper, category, 1)); Assert.AreEqual("/blog/category/test-category/page-2", BlogUrlHelperExtensions.BlogCategory(mocks.UrlHelper, category, 2)); }
/// <summary> /// Gets the URL to the specified blog category RSS feed /// </summary> /// <param name="urlHelper">The URL helper</param> /// <param name="category">Category to link to</param> /// <returns>The URL</returns> public static string BlogCategoryFeed(this IUrlHelper urlHelper, CategoryModel category) { return BlogCategory(urlHelper, "CategoryFeed", category.Slug, category.Parent?.Slug); }
/// <summary> /// Gets the URL to the specified blog category post listing /// </summary> /// <param name="urlHelper">The URL helper</param> /// <param name="category">Category to link to</param> /// <param name="page">Page number to link to</param> /// <returns>The URL</returns> public static string BlogCategory(this IUrlHelper urlHelper, CategoryModel category, int page = 1) { return BlogCategory(urlHelper, "Category", category.Slug, category.Parent?.Slug, page); }
/// <summary> /// Gets the URL to the specified blog tagged post listing /// </summary> /// <param name="urlHelper">The URL helper</param> /// <param name="category">Category to link to</param> /// <param name="page">Page number to link to</param> /// <returns>The URL</returns> public static string BlogCategory(this UrlHelper urlHelper, CategoryModel category, int page = 1) { return urlHelper.BlogCategory(category.Slug, page); }