Even though I've understood the principle of mocks, stubs and class abstraction for a testable design, there's something that's still very unclear to me.
Working with .NET, there are a lot of built-in classes, such as StackTrace for example, located under the Diagnostics namespace.
Some of those classes contain collections of other classes, and those classes contain other classes as well, etc. etc. etc... - The containment principle.
For example: The StackTrace
class contains an array of StackFrame
objects, which itself has a method returning a MethodBase
object.
Say none of those classes are abstract, meaning they can't be mocked directly - How could one design the code to be able to mock those classes, without creating tons of wrapping classes and wasting a lot of crutial time on it?
I hope I'm clear enough on that one.