Last active
August 29, 2015 14:12
-
-
Save joebuschmann/97314cf578cefff7ac01 to your computer and use it in GitHub Desktop.
When using numeric identifiers in Gherkin - code this
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Given(@"I have the following products")] | |
| public void GivenIHaveTheFollowingProducts(Table table) | |
| { | |
| _productIdLookup = new Dictionary<string, int>(); | |
| foreach (var row in table.Rows) | |
| _productIdLookup.Add(row["Name"], row.GetInt32("Id")); | |
| } | |
| [When(@"I select the (.*)")] | |
| public void WhenISelectThe(string productName) | |
| { | |
| if (!_productIdLookup.ContainsKey(productName)) | |
| Assert.Fail("The product {0} does not exist in the look up dictionary.", productName); | |
| _selectedProductId = _productIdLookup[productName]; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment