The System Under Test (SUT)

The System Under Test is the class you are testing. SpecsFor will automatically create an instance of this class for you and store it in a property named SUT. You can access this object at any phase of the SpecsFor lifecycle after InitializeClassUnderTest has been executed.

You tell SpecsFor what your System Under Test is going to be by specifying it as the type parameter when you derived from the SpecsFor base class. Whatever you specify for T becomes your System Under Test.

public class given_a_car_is_started_when_a_car_is_stopped : SpecsFor<Car>
		{
			protected override void Given()
			{
				//Given: establish state, in this case, that the car is started.
				SUT.Start();
			}

			protected override void When()
			{
				//When: perform an action, in this case, stopping the car.
				SUT.Stop();
			}

			//Note that there can be (and usually are) multiple 'Then' test cases.
			[Test]
			public void then_the_car_is_stopped()
			{
				//Then: the car is stopped.
				SUT.IsStopped.ShouldBeTrue();
			}

			[Test]
			public void then_the_engine_is_stopped()
			{
				//Then: the engine is stopped.
				SUT.Engine.IsStopped.ShouldBeTrue();
			}
		}

When SpecsFor creates your SUT, it automatically creates mock objects for any mockable dependencies. See SpecsFor and mocking for more information.