Skip to content

Commit

Permalink
Update VerifierSettings.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp committed Oct 7, 2023
1 parent 2fd752e commit 334593d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Verify/Naming/VerifierSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,13 @@ static void GetNameForParameter(object? parameter, StringBuilder builder, bool i
return;
}

foreach (var parameterToName in parameterToNameLookup)
var type = parameter.GetType();

foreach (var (key, value) in parameterToNameLookup)
{
if (parameterToName.Key.IsInstanceOfType(parameter))
if (key.IsAssignableFrom(type))
{
builder.Append(parameterToName.Value(parameter));
builder.Append(value(parameter));
return;
}
}
Expand Down Expand Up @@ -90,7 +92,6 @@ static void GetNameForParameter(object? parameter, StringBuilder builder, bool i
return;
}

var type = parameter.GetType();
if (type.IsGeneric(typeof(KeyValuePair<,>)))
{
var keyMember = type.GetProperty("Key")!.GetMethod!.Invoke(parameter, null);
Expand Down

0 comments on commit 334593d

Please sign in to comment.