zHaytam / SmartBreadcrumbs

A utility library for ASP.NET Core (both MVC and Razor Pages) websites to easily add and customize breadcrumbs.
https://blog.zhaytam.com/2018/06/24/asp-net-core-using-smartbreadcrumbs/
MIT License
161 stars 77 forks source link

Added possibility for assigning RazorPagesRootDirectory through BreadcrumbOptions #65

Closed ahmedatia closed 4 years ago

ahmedatia commented 4 years ago

In reference to issue #56 , one use case that results to changing the default razor pages root directory if a project is utilizing FeatureFolders and then the razor pages root directory is also changed to use Features folder.

services.AddRazorPages(options =>
{
    options.RootDirectory = "/Features";
});

Now we can set which root directory SmartBreadcrumbs is used through BreadcrumbOptions

services.AddBreadcrumbs(Assembly.GetExecutingAssembly(), options =>
{
    options.RazorPagesRootDirectory = "Features";
});
zHaytam commented 4 years ago

Hello, thank you for the PR! Can you please fix the failing unit test?

ahmedatia commented 4 years ago

Thanks @zHaytam ... Yep! I noticed this only after I submitted PR as I was only running tests related to this change, my bad!

If I'm not mistaken it is related to the shared state between tests. I'll have a more detailed look and address it accordingly.

ahmedatia commented 4 years ago

Hello @zHaytam ... all good to go! It is worth mentioning that I moved the test case I created for this change to a separate class to ensure having a self-contained context for unit tests when default RazorPagesRootDirectory is modified.

zHaytam commented 4 years ago

Thank you @ahmedatia ! I will update NuGet today.

zHaytam commented 4 years ago

Version 3.4 is online!