Cucumber 我可以用SpecFlow.Assist替换表中的值吗?
我目前有一个步骤来验证付款Cucumber 我可以用SpecFlow.Assist替换表中的值吗?,cucumber,specflow,Cucumber,Specflow,我目前有一个步骤来验证付款 Then I have these payments: | Payment Type | Amount | | Cash | 1.20 | 我想用一个变量替换“Amount”,比如TestContext中的bill total Then I have these payments: | Payment Type | Amount | | Cash | <billTotal> | 那么我有这些付款: |付款类
Then I have these payments:
| Payment Type | Amount |
| Cash | 1.20 |
我想用一个变量替换“Amount”,比如TestContext中的bill total
Then I have these payments:
| Payment Type | Amount |
| Cash | <billTotal> |
那么我有这些付款:
|付款类型|金额|
|现金||
我试图在创建集合之前预处理该表,但无法为TableRow值赋值。有没有标准的方法来实现这一点?我是否应该采取不同的方法?在创建我的集合之前,我使用了类似的方法:
public void AdjustTable(Table table)
{
foreach (var row in table.Rows)
{
foreach (var key in row.Keys)
{
if (row[key] == "<userFirstName>")
{
row[key] = this.testContext.CustomerProfile.Customer.Name.First;
}
else if (row[key] == "<userLastName>")
{
row[key] = this.testContext.CustomerProfile.Customer.Name.Last;
}
}
}
}
公共无效调整表(表)
{
foreach(表中的变量行。行)
{
foreach(行中的var键。键)
{
如果(行[键]==“”)
{
行[键]=this.testContext.CustomerProfile.Customer.Name.First;
}
else if(行[键]=“”)
{
行[键]=this.testContext.CustomerProfile.Customer.Name.Last;
}
}
}
}
仍然可以接受建议 为什么会有反对票?请告诉我这个问题的问题。