Then for regular Asserts.

Feb 11, 2011 at 4:16 AM

In some cases, there are times when I need to assert things without having an easy way to break it down to return a bool.

For now I can work around it by returning true to satisfy the fun<bool> requirement, but having one not require that would be nice.

Coordinator
Feb 14, 2011 at 6:04 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Coordinator
Feb 16, 2011 at 2:02 AM

Hi Rangoric,

Thanks for the discussion. I had a quick look at also supporting Action on the Then clauses as well as Func but I haven’t had any success yet.

The problem is that by using dynamic objects (for state) it incorrectly discovers the Func version of the Then/And extensions.

So it’s a trade off – do we drop dynamic objects, or do we go for supporting void results in the Then/And statements.

Feb 16, 2011 at 4:36 PM

In that case I wouldn't worry about it. I have a work around that is doing fine. The main place this comes up is with the MvcContrib route checks but I've just done the following (not a serious example but gets the idea across for the work around).

Given("Some Text", x => DoSomething())
    .When("we dance", x => Dance())
    .Then("make sure we are ok", x => { MvcContribRouteAssert; return true});