More Fluent Interfaces for NUnit.Behave


I have been enhancing the overall structure of NUnit.Behave to evolve to a more fluent interface.  The following is a working example of what I have come up with.

 

            Story("Account Holder withdraws cash")
                .As_a("savings account holder")
                .I_Want("to transfer money from my savings account")
                .So_That("I can get cash easily from an ATM")
                .Scenario("savings account is overdrawn")
                .Given("my savings account balance is", -20)
                .And("my cash account balance is", 10)
                .When("I transfer to cash account", 20)
                .Then("my savings account balance should be", -20)
                .And("my cash account balance should be", 10);

<p>
  &nbsp;In the test runner the following output appears.
</p>

<p>
  <font face="Courier New">Story: Account Holder withdraws cash<br />Narrative: As a savings account holder <br />&nbsp;&nbsp;&nbsp; I want to transfer money from my savings account <br />&nbsp;&nbsp;&nbsp; so that I can get cash easily from an ATM. </font>
</p>

<p>
  <font face="Courier New">&nbsp;&nbsp;&nbsp; Scenario: savings account is overdrawn<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Given my savings account balance is: -20 !PENDING Delegate IMPLEMENTATION!<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; And my cash account balance is: 10 !PENDING Delegate IMPLEMENTATION!<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; When I transfer to cash account: 20 !PENDING Delegate IMPLEMENTATION!<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Then my savings account balance should be: -20 !PENDING Delegate IMPLEMENTATION!<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; And my cash account balance should be: 10 !PENDING Delegate IMPLEMENTATION!</font>
</p>

<p>
  Don&#8217;t worry I am working on &#8220;!PENDING&#8221; but I just needed something as placeholder for the time being.
</p>

<p>
  I love this fluent interface approach though.&nbsp; It really makes the code much more maintainable.
</p>
← Introducing NUnit.Behave or insert what ever other catchy name
NUnit.Behave Mentioned in The Carnival of Agilists →