2017-08-28 176 views
-1

我現在有一個步驟,以驗證支付我可以使用SpecFlow.Assist替換表中的值嗎?

Then I have these payments: 
| Payment Type | Amount | 
| Cash   | 1.20 | 

我想與一個變量來替換「金額」,如紙幣總這將是在的TestContext。

Then I have these payments: 
| Payment Type | Amount  | 
| Cash   | <billTotal> | 

我試圖在創建我的集之前預處理表,但我無法分配給TableRow值。有沒有一個標準的方法來實現這一目標?我應該採取不同的方法嗎?

+0

爲什麼downvotes?請讓我知道這個問題的問題。 – Kim

回答

0

最後我用這樣的創造我之前設置:

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; 
       } 
      } 
     } 
    } 

仍然是開放的建議!

相關問題