---
agentTools:
  projectIndex: https://specsfor.readme.io/llms.txt
---

# Verifying with 'Then'

In the [Given, When, Then](https://specsfor.readme.io/docs/given-when-then) setup, the Then step is for you that the action you performed against the [System Under Test (SUT)](https://specsfor.readme.io/docs/the-system-under-test-sut) had the desired outcome(s).

Consider our simple spec again:

[block:callout]
{
  "type": "info",
  "body": "Given a car is started, when the car is stopped, then the engine is stopped."
}
[/block]

Unlike Given and When, there is no Then method to override in SpecsFor.  Instead, you create test cases for each outcome you wish to verify, like so:

[block:code]
{
  "codes": [
    {
      "code": "[Test]\npublic void then_the_engine_is_stopped()\n{\n  //Then: the engine is stopped.\n  SUT.Engine.IsStopped.ShouldBeTrue();\n}",
      "language": "csharp"
    }
  ]
}
[/block]

[block:callout]
{
  "type": "warning",
  "title": "BE CAREFUL!",
  "body": "Be sure you decorate each of your test cases with the NUnit Test attribute.  If you don't, NUnit won't see your test cases, and they won't be executed."
}
[/block]

The above spec only had a single outcome to verify, but it's not uncommon for specs to have multiple things to check:

[block:callout]
{
  "type": "info",
  "body": "Given a car is started, when the car is stopped..\n   then the car is stopped.\n   then the engine is stopped."
}
[/block]

The full SpecsFor implementation of this spec would look like this:

[block:code]
{
  "codes": [
    {
      "code": "public class given_a_car_is_started_when_a_car_is_stopped : SpecsFor<Car>\n{\n  protected override void Given()\n  {\n    //Given: establish state, in this case, that the car is started.\n    SUT.Start();\n  }\n\n  protected override void When()\n  {\n    //When: perform an action, in this case, stopping the car.\n    SUT.Stop();\n  }\n\n  //Note that there can be (and usually are) multiple 'Then' test cases.\n  [Test]\n  public void then_the_car_is_stopped()\n  {\n    //Then: the car is stopped.\n    SUT.IsStopped.ShouldBeTrue();\n  }\n\n  [Test]\n  public void then_the_engine_is_stopped()\n  {\n    //Then: the engine is stopped.\n    SUT.Engine.IsStopped.ShouldBeTrue();\n  }\n}",
      "language": "csharp"
    }
  ]
}
[/block]