-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added unit test for RedisCacheWrapper. #16787
Added unit test for RedisCacheWrapper. #16787
Conversation
I think I will do it but it's great that you picked up 😁 |
I will review you the PR tomorrow if not today |
Yeah, I saw that you're assigned to that issue. I was just thinking about how one may test something like this and wanted to share my approach. Feel free to close this PR, if you have a different or better way of doing it.🤗 |
src/OrchardCore.Modules/OrchardCore.Redis/OrchardCore.Redis.csproj
Outdated
Show resolved
Hide resolved
test/OrchardCore.Tests/Modules/OrchardCore.Redis/RedisCacheWrapperTests.cs
Show resolved
Hide resolved
…proj Co-authored-by: Hisham Bin Ateya <[email protected]>
|
||
public RedisCacheWrapper(IOptions<RedisCacheOptions> optionsAccessor) => _cache = new RedisCache(optionsAccessor); | ||
public RedisCacheWrapper(IDistributedCache cache) => _cache = cache ?? throw new ArgumentNullException(nameof(cache)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why you changed the parameter type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because RedisCache
cannot be easily mocked for unit testing.
@sebastienros do you have anything else to add here? |
Fixes #16761
/cc @hishamco