Blazorade / Blazorade-MSAL

A Blazor component library that makes it easy to use authentication in your application through MSAL, both in Blazor Server and Blazor WebAssembly applications.
MIT License
17 stars 5 forks source link

Support mocking BlazoradeMsalService #23

Closed HolisticDeveloper closed 2 years ago

HolisticDeveloper commented 2 years ago

I'd like to be able to unit test my components that utilize BlazoradeMsalService. Can the methods be made virtual so that they can be overridable?

MikaBerglund commented 2 years ago

I'll look into that, but I see no reason why not. I guess the correct way would be to define an interface that is used when injecting.

MikaBerglund commented 2 years ago

I guess the easier way would be to set all methods on the BlazoradeMsalService to virtual so that they can all be overridden for testing purposes. So, if that's OK with you, I guess that's what I'll do for now.

MikaBerglund commented 2 years ago

There is now a PR #24 waiting. If that would be enough for your needs @HolisticDeveloper, I can go ahead and complete the PR and publish a new version to Nuget.