diff --git a/Src/FluentAssertions/Common/MemberPath.cs b/Src/FluentAssertions/Common/MemberPath.cs index 573302959d..fe13ce2cb2 100644 --- a/Src/FluentAssertions/Common/MemberPath.cs +++ b/Src/FluentAssertions/Common/MemberPath.cs @@ -106,7 +106,9 @@ public bool HasSameParentAs(MemberPath path) public bool GetContainsSpecificCollectionIndex() => dottedPath.ContainsSpecificCollectionIndex(); private string[] Segments => - segments ??= dottedPath.Split(new[] { '.', '[', ']' }, StringSplitOptions.RemoveEmptyEntries); + segments ??= dottedPath + .Replace("[]", "[*]") + .Split(new[] { '.', '[', ']' }, StringSplitOptions.RemoveEmptyEntries); /// /// Returns the name of the member the current path points to without its parent path. diff --git a/Src/FluentAssertions/Equivalency/Selection/ExcludeMemberByPathSelectionRule.cs b/Src/FluentAssertions/Equivalency/Selection/ExcludeMemberByPathSelectionRule.cs index 9be677dd3c..9651225eca 100644 --- a/Src/FluentAssertions/Equivalency/Selection/ExcludeMemberByPathSelectionRule.cs +++ b/Src/FluentAssertions/Equivalency/Selection/ExcludeMemberByPathSelectionRule.cs @@ -25,7 +25,7 @@ public ExcludeMemberByPathSelectionRule(MemberPath pathToExclude) public void CombinePath(MemberPath nextPath) { - memberToExclude = memberToExclude.Combine(nextPath, "[*]"); + memberToExclude = memberToExclude.Combine(nextPath, "[]"); SetSelectedPath(memberToExclude.ToString()); }