This project is read-only.
1

Closed

Add support to add many dependencies once and setup later

description

Add support to add many dependencies once and setup later.
 
Useful when working with tests contaning similar setups but with some differences.
The user can add the dependencies and setup the common dependencies in some helper method, or even in [ClassInitialize] and then in proper tests setup other specific dependencies. We will gain many possibilities to setups:
 
private Isolator CreateIsolatorWithCommonSetups()
{
var isolator = new Isolator();
 
isolator.AddDependencies<IDep1, IDep2, IDep3>();
 
isolator.SetDependency<IDep1>().WithStubFor(m => m.Xpto()).ReturningOne();
isolator.SetDependency<IDep2>().WithStubFor(m => m.Abcd()).ReturningWith(10).Then()
          .SetDependency<IDep3>().WithMockFor(m => m.Yyyy()).CannotBeCalled();
 
isolator.AddDependency<IDep4>().WithStubFor(m => m.Efgh()).ReturningOne();
 
return isolator;
}
Closed Aug 10, 2011 at 3:37 PM by andborges
Done

comments