Skip to content

Commit

Permalink
Re-define indexers as parameterized properties
Browse files Browse the repository at this point in the history
  • Loading branch information
stakx committed Aug 8, 2019
1 parent 7144822 commit a107271
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Moq/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ public static bool IsPropertyGetter(this MethodInfo method)

public static bool IsPropertyIndexerGetter(this MethodInfo method)
{
return method.IsSpecialName && method.Name.Equals("get_Item", StringComparison.Ordinal);
return method.IsSpecialName && method.Name.StartsWith("get_", StringComparison.Ordinal) && method.GetParameters().Length > 0;
}

public static bool IsPropertyIndexerSetter(this MethodInfo method)
{
return method.IsSpecialName && method.Name.Equals("set_Item", StringComparison.Ordinal);
return method.IsSpecialName && method.Name.StartsWith("set_", StringComparison.Ordinal) && method.GetParameters().Length > 1;
}

public static bool IsPropertySetter(this MethodInfo method)
Expand Down

0 comments on commit a107271

Please sign in to comment.