3 ms·
Suppose you want to unit test some function you've written that makes use of a library that doesn't implement interfaces. You can either write a wrapper interfa
by papreclip 7y ago
Suppose you want to unit test some function you've written that makes use of a library that doesn't implement interfaces. You can either write a wrapper interface for the library and inject this wrapper as your dependency, or you can just use the library as-is and hook the function calls in your tests using OP's library. The first method might be the "proper" way of doing things, but you end up with slightly more cluttered code purely to serve the needs of your unit tests. In the second case, any unsafe code is never going into production
It's sort of like asking "What's a good use of WriteMemoryProcess or CreateRemoteThread". It's not the kind of tool you acquire and then go find uses for, it's something you will resort to only when you have no other logical choice