Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

Commit

Permalink
Make new utility method more closely resemble pre-existing private me…
Browse files Browse the repository at this point in the history
…thod.
  • Loading branch information
Auk14HP committed Aug 18, 2021
1 parent 095734e commit a9ba587
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,15 @@ public static void VerifyResultIsExpected<TResponse, TProperty>(this TResponse r
if (propertyName == null)
return null;

return response.GetType().GetRuntimeProperties().FirstOrDefault(x =>
x.GetMethod != null &&
var property = response.GetType().GetRuntimeProperties().FirstOrDefault(x =>
x.GetMethod is object &&
!x.GetMethod.IsStatic &&
string.Equals(x.Name, propertyName, StringComparison.OrdinalIgnoreCase));

if (property is object && property.SetMethod is null)
property = property.DeclaringType.GetRuntimeProperty(property.Name);

return property;
}
}
}

0 comments on commit a9ba587

Please sign in to comment.