0
comment
comment
on 9/29/2010 11:07 AM
I have had troubles writing unit tests for classes with a lot of dependencies. The reason for this is that the initialization of the state for my test code would look like:
[Setup]
public void Setup()
{
stub1 = new Mock();
…
stub20 = new Mock();
mock = new Mock();
…// Setup mock and stub behavior
classToTest = new TypeOfClass( /a lot of code/);
}
This isn’t very maintainable. How do we make this easier to maintain? I’ve introduced a helper class that initializes most of the interfaces to stubs of [...]