Hi 👋
I’m trying to write unit tests for a class that depends on IFusionCache.
The issue I’m facing is that most of the commonly used methods (like GetOrSetAsync, etc.) are implemented as extension methods in the NuGet package. Because of that:
- These methods are static extension methods
- They are not directly part of the IFusionCache interface
- They cannot be mocked with standard mocking frameworks (e.g. Moq, NSubstitute, etc.)
- It’s unclear which underlying interface method is actually being invoked internally
As a result, when I mock IFusionCache, my tests fail because the extension methods are not interceptable, and I don’t know which original interface method I should be setting up in my mock.
Would it be possible to move key methods into the interface instead of extension methods to improve mockability?
Regards