You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Scenario: Amount is not negative
Given a Validator
Given a TestData
And MinimumAmount is -0.01
When validator is invoked
Then validator sets validation error
SpecFlow generated the following binding for the MinimumAmount:
[Given]
public void Given_MinimumAmount_is_P0(decimal p0)
{
....
}
But when executed, the value passed to the step is 0.01 and not -0.01.
If I change the [Given] attribute to:
[Given(@"MinimumAmount is (.*)")]
It works as expected.
The text was updated successfully, but these errors were encountered:
… as arguments when using regexless methods. The underlyinh problem was that when using regexless parameters a regex is generated, and this regex was using '\W' between any words in the method name. this matches anything which is not a-zA-Z0-9_, which includes the '-' character which is part of the negative number. As I think that we are really matching gaps between words I have changed this to use '\s' which simply matches any whitespace characters. We could instead explictily use the non-word match and add the '-' character if we change it to '[^a-zA-Z0-9-]'. Both make the test pass, but the withspace one seems better to me. Any input appreciated.
This area does not contain any unit tests, but I have added an integration test which checks this, and based it on the scenario in the issue which this fixes, SpecFlowOSS#246
I might be able to add some unit tests in the future, but this seems sufficient for now.
As described here: http://stackoverflow.com/q/13020480/8220
Using SpecFlow, I have this scenario:
SpecFlow generated the following binding for the MinimumAmount:
But when executed, the value passed to the step is
0.01
and not-0.01
.If I change the
[Given]
attribute to:[Given(@"MinimumAmount is (.*)")]
It works as expected.
The text was updated successfully, but these errors were encountered: