About Me

Training

Develop With Passion® - Developer Bootcamp

Subscribe

Creating the SUT explicitly in developwithpassion.specifications

Written April 07, 2011 at 09:00 MDT Tagged developwithpassion.specifications

There will be times when you will want to explicilty specify how the SUT should be created when you are inheriting from either of the following classes:

To accomplish this you need to leverage the following block of code in the Establish block for your context:

  sut_factory.create_using(factory);

Factory will be of type SUTFactory which is bascially just a delegate type that takes no arguments and returns an instance of the system under test.

Most likely you will be using it as follows:

  sut_factory.create_using(() => new Calculator()) 

Hope this helps out!!

Develop With Passion®