-
Notifications
You must be signed in to change notification settings - Fork 732
BeInAscendingOrder() fails with ArgumentNullException #1803
Copy link
Copy link
Closed
Description
Description
BeInAscendingOrder fails when used with a propertyExpression parameter
Complete minimal example reproducing the issue
[Test]
public void When_testing_order_of_lists()
{
var actual = new[] {1, 2, 3, 4};
actual.Should().BeInAscendingOrder(x => x);
}Expected behavior:
Should not fail.
Actual behavior:
Test fails with ArgumentNullException
Stack Trace:
System.ArgumentNullException : A member path cannot be null or empty (Parameter 'dottedPath')
at FluentAssertions.Common.Guard.ThrowIfArgumentIsNullOrEmpty(String str, String paramName, String message)
at FluentAssertions.Common.MemberPath..ctor(String dottedPath)
at FluentAssertions.Common.ExpressionExtensions.GetMemberPath[TDeclaringType,TPropertyType](Expression`1 expression)
at FluentAssertions.Collections.GenericCollectionAssertions`3.IsValidProperty[TSelector](Expression`1 propertyExpression, String because, Object[] becauseArgs)
at FluentAssertions.Collections.GenericCollectionAssertions`3.BeOrderedBy[TSelector](Expression`1 propertyExpression, IComparer`1 comparer, SortOrder direction, String because, Object[] becauseArgs)
at FluentAssertions.Collections.GenericCollectionAssertions`3.BeInAscendingOrder[TSelector](Expression`1 propertyExpression, IComparer`1 comparer, String because, Object[] becauseArgs)
at FluentAssertions.Collections.GenericCollectionAssertions`3.BeInAscendingOrder[TSelector](Expression`1 propertyExpression, String because, Object[] becauseArgs)Versions
-
Which version of Fluent Assertions are you using?
- 6.5.0
Additional Information
Removing the propertyExpression parameter and just using .BeInAscendingOrder() works as expected.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels