How do I get SpecFlow to expect an exception?

Posted by Roger Lipscombe on Stack Overflow See other posts from Stack Overflow or by Roger Lipscombe
Published on 2010-05-21T08:46:01Z Indexed on 2010/05/22 0:20 UTC
Read the original article Hit count: 491

Filed under:
|
|

I'm using SpecFlow, and I'd like to write a scenario such as the following:

Scenario: Pressing add with an empty stack throws an exception
    Given I have entered nothing into the calculator
    When I press add
    Then it should throw an exception

It's calculator.Add() that's going to throw an exception, so how do I handle this in the method marked [Then]?

© Stack Overflow or respective owner

Related posts about bdd

Related posts about specflow