aspnet / Identity

[Archived] ASP.NET Core Identity is the membership system for building ASP.NET Core web applications, including membership, login, and user data. Project moved to https://github.com/aspnet/AspNetCore
Apache License 2.0
1.96k stars 868 forks source link

Added SignInManager interface #1777

Closed ghost closed 6 years ago

ghost commented 6 years ago

It is terrible to mock SignInManager without an interface.

dnfclas commented 6 years ago

CLA assistant check
All CLA requirements met.

HaoK commented 6 years ago

This shouldn't really affect mocking, you can already Mock SignInManager<TUser> already, existing code is already asking for SignInManager from DI, irrespective of this being a breaking change, adding an interface isn't going to change anything unless all the consuming code was updated to depend on this new interface.

See https://github.com/aspnet/Identity/blob/f51af820a5ccf2268b785c62140b29bbb5a24e83/test/Identity.Test/SecurityStampValidatorTest.cs#L105 for an example of how we mock sign in manager today

ghost commented 6 years ago

I know that. It was just the act of my annoyance. Actually I think that it is better to separate this huge classes to smaller with less injected dependencies or to remove null checks for some dependencies in their constructors so to eliminate the need to be mocked 5-6 classes just to simulate return value for one method only.