Skip to content
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

Add IRedisConnectionProvider interface #249

Closed
jcreus1 opened this issue Nov 1, 2022 · 0 comments · Fixed by #250
Closed

Add IRedisConnectionProvider interface #249

jcreus1 opened this issue Nov 1, 2022 · 0 comments · Fixed by #250

Comments

@jcreus1
Copy link
Contributor

jcreus1 commented Nov 1, 2022

Hi @slorello89. I'd like to extract an interface for the RedisConnectionProvider class, to allow mocking/substitution for unit testing.

My use case is that I have an ASP.NET Core Web API project injecting a RedisConnectionProvider object into my caching implementation class:

Program.cs
image

Caching Implementation:
image

I am currently unable to unit test this class, as our chosen mocking tool (NSubstitute) requires either an interface or a concrete implementation containing virtual methods it can override. I would therefore like to create an IRedisConnectionProvider interface and to update each reference to RedisConnectionProvider to use this interface.

Will raise a PR with a simple implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant