Robbiew.Online
Robbiew.Online
CC#
Created by Stevvvvvvvvvvvvvvvvvie on 8/15/2023 in #help
✅ Use static class or DI?
You could also introduce a factory, which when you're not testing returns back your static cache, but in tests could return a different one for your required test.
Nowadays I'd go for IoC unless it's a utilities class like a unit converter, string helper, etc. where you know you'll never need a variant of it, ever.
9 replies