【发布时间】:2015-07-16 13:38:15
【问题描述】:
我有这个功能
Feature: Selling Holiday
As a person selling holiday
I want to know the bonus per month
Scenario Outline: Selling Holiday
Given I am selling holiday
And I have a current salary rate of <rate> pounds an hour
And I have chosen <hours> hours
Then the cost should be <cost>
Examples:
| rate | hours | cost |
| 9.00 | 14 | -10.2 |
| 12.00 | 14 | -14 |
| 8.0 | 7.5 | -5 |
[Then]
public void Then_the_cost_should_be_COST(decimal cost)
{
//Cost is always positive :(
Assert.AreEqual(cost, holidayCostCalculator.CalculateCost();
}
问题在于成本正像我所说的那样积极而不是消极地传递到步骤中。
这里还有一个问题,他们通过添加属性解决了这个问题,但在我看来这不是一个可接受的解决方案,因为它一点也不直观。
【问题讨论】:
-
如果它没有通过,那么听起来可能是一个错误。您使用的是什么版本(nuget 和扩展)?可能值得在 github 上提出一个问题,我也许可以在接下来的几天内查看它。作为一种解决方法,您可以让此步骤临时在属性中使用正则表达式。
-
我的扩展名是
2015.1.2,nuget 版本是1.9。我刚刚发现了一个开放的问题,但它可能已经过时了,因为它自 2012 年以来就一直开放。github.com/techtalk/SpecFlow/issues/246。如果有帮助,我很乐意开一个新的。 -
似乎是同一个问题。看到您已经更新了扩展,您可以尝试从 ci.appveyor.com/nuget/specflow-ci 构建的 v2 nuget beta 版本,以防万一它神奇地自行修复。
-
刚刚用 v2 源试了一下,恐怕还是同样的问题。
-
好的,太好了。谢谢。我试试看。