Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,15 @@ private StepTitle CreateTitle(string stepTextTemplate, bool includeInputsInStepT
{
if (_testContext.Examples != null)
{
var matchingHeader = _testContext.Examples.Headers
.SingleOrDefault(header => ExampleTable.HeaderMatches(header, i.ParameterName) ||
ExampleTable.HeaderMatches(header, i.Value.Name));
var matchingHeaders = _testContext.Examples.Headers
.Where(header => ExampleTable.HeaderMatches(header, i.ParameterName) ||
ExampleTable.HeaderMatches(header, i.Value.Name))
.ToList();

if (matchingHeaders.Count > 1)
throw new ArgumentException($"Cannot uniquely distinguish parameter name between '{methodInfo.Name}' method's parameter name '{i.ParameterName}' and header's name '{i.Value.Name}'");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
throw new ArgumentException($"Cannot uniquely distinguish parameter name between '{methodInfo.Name}' method's parameter name '{i.ParameterName}' and header's name '{i.Value.Name}'");
throw new AmbiguousMatchException ($"More than one headers for examples, match the parameter '{i.ParameterName}' provided for '{methodInfo.Name}'");

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would need System.Reflection namespace. It would be a good idea to add a test for this change


var matchingHeader = matchingHeaders.SingleOrDefault();
if (matchingHeader != null)
return string.Format("<{0}>", matchingHeader);
}
Expand Down