0
sumitshah created
We are using ASP NET Zero v7.2.0.
For unit testing, instead of using seed date have connected to the actual database.
While running the unit tests on one of the AppService method we are encountering the below issue.
Castle.MicroKernel.Handlers.HandlerException : Can't create component 'Infogroup.IDMS.Caching.RedisCacheHelper' as it has dependencies to be satisfied.
'Infogroup.IDMS.Caching.RedisCacheHelper' is waiting for the following dependencies:
- Service 'Microsoft.Extensions.Caching.Distributed.IDistributedCache' which was not registered.
We created a helper class in which we have injected IDistributedCache for various redis opertions.which is being injected in the AppService.
Is there any way to get Redis cache work in the Test Project.
Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)
1 Answer(s)
-
0
hi
Are you using the
AddStackExchangeRedisCachemethod in unit test?https://docs.microsoft.com/en-us/aspnet/core/performance/caching/distributed?view=aspnetcore-3.1#distributed-redis-cache
However, I do not recommend using a real database in testing.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image)