Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BeInAscendingOrder() fails with ArgumentNullException #1803

Closed
cobussmit74 opened this issue Feb 11, 2022 · 2 comments · Fixed by #1802
Closed

BeInAscendingOrder() fails with ArgumentNullException #1803

cobussmit74 opened this issue Feb 11, 2022 · 2 comments · Fixed by #1802

Comments

@cobussmit74
Copy link

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.

@jnyrup jnyrup linked a pull request Feb 11, 2022 that will close this issue
5 tasks
@jnyrup
Copy link
Member

jnyrup commented Feb 11, 2022

Thanks for reporting this.
I started my DeLorean, cranked it up to 88 mph and created #1802 to fix #1803.

@jnyrup
Copy link
Member

jnyrup commented Feb 11, 2022

6.5.1 with the fix is now available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants