As the title says how does specflow handle this
x = AddUp(2, 3)
x = AddUp(5, 7, 8, 2)
x = AddUp(43, 545, 23, 656, 23, 64, 234, 44)
The link I gave is how it is usually done.
What i want to know is what should the annotation on the top be?
[Then(@"What should I write here")]
public static void AddUp(params int[] values)
{
int sum = 0;
foreach (int value in values)
{
sum += value;
}
return sum;
}
解决方案
You add parameters by adding single quote marks like this:
[When(@"I perform a simple search on '(.*)'")]
public void WhenIPerformASimpleSearchOn(string searchTerm)
{
var controller = new CatalogController();
actionResult = controller.Search(searchTerm);
}
you can use comma seperated lists
When i login to a site
then 'Joe,Bloggs,Peter,Mr,Some street,15' are valid
Also you can use table vales
When I login to a site
then the following values are valid
| FirstName | LastName | MiddleName | Greeting| Etc | Etc |
| Joe | Bloggs | Peter | Mr | you get| The Idea|