Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SpecFlow: System.FormatException: Input string was not in a correct format

Tags:

c#

bdd

specflow

I was getting the following error when running my tests using SpecFlow:

System.FormatException: Input string was not in a correct format.

And it took me a while to work out why it was happening.

like image 516
csharpsql Avatar asked Apr 01 '15 14:04

csharpsql


1 Answers

It ended up being because I had omitted the single quotes in one of my step definitions, for example:

[Then(@"Something adds up to a quantity of (.*)")]

when it should have been

[Then(@"Something adds up to a quantity of '(.*)'")]

Note the single quotes around (.*)

like image 117
csharpsql Avatar answered Sep 28 '22 08:09

csharpsql