expected-exception

CodeCoverage vs ExpectedException

I've got several unittests of this pattern: [TestMethod ()] [ExpectedException (typeof (ArgumentNullException))] public void DoStuffTest_Exception () { var foo = new Foo (); Foo.DoStuff (null); } It turns out that code coverage markes the throwing line as half-run, so I get 1 block of uncovered code each time. After thinking ...

How do I get SpecFlow to expect an exception?

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 ...