Validating a matrix

Table of Contents

The following example iterates through a list of years. Within every year, it also iterates through the months 1 to 12. And within each month it iterates through a list of sales-territories.

This leads to multiple testcase-executions for each of the months of all years and also for all sales-territories.

var countries = new List
{
  "Australia",
  "Canada",
  "France",
  "Germany",
  "United Kingdom",
  "United States"
};

for(var year = 2010; year <= 2011; year++)
{
  for(var month = 10; month <= 12; month++)
  {
    foreach(var country in countries)
    {
      SetComment($"{year}.{month} - {country}");

      SetParameter("Year", year);
      SetParameter("Month", month);
      SetParameter("Country", country);

      await ExecuteAsync();
    }
  }
}