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);
In the test runner the following output appears.
Story: Account Holder withdraws cash
Narrative: 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 !PENDING Delegate IMPLEMENTATION!
And my cash account balance is: 10 !PENDING Delegate IMPLEMENTATION!
When I transfer to cash account: 20 !PENDING Delegate IMPLEMENTATION!
Then my savings account balance should be: -20 !PENDING Delegate IMPLEMENTATION!
And my cash account balance should be: 10 !PENDING Delegate IMPLEMENTATION!
Don’t worry I am working on “!PENDING” but I just needed something as placeholder for the time being.
I love this fluent interface approach though. It really makes the code much more maintainable.
Post Footer automatically generated by Add Post Footer Plugin for wordpress.

What about:
Story.Title(“Account Holder withdraws cash”)
.As_a(“savings account holder”)
…
That way I don’t have to inherit from an abstract class?
I am working on this right now. Hope to have something out shortly.
Love where you’re going with this! Will definitely dl this
Love where you’re going with this! Will definitely dl this