From 6fffb894e356d651d28a54595e4f8f0e0d32d3f3 Mon Sep 17 00:00:00 2001 From: Oliver Seitz Date: Fri, 18 Feb 2022 00:00:14 +0100 Subject: [PATCH] Add * just in segments, not in dottedPath --- Src/FluentAssertions/Common/MemberPath.cs | 4 +++- .../Equivalency/Selection/ExcludeMemberByPathSelectionRule.cs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) 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()); }