-
Notifications
You must be signed in to change notification settings - Fork 731
Order by multiple properties sequentially #1416
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
Conversation
|
ThenNotBeInAscendingOrder and ThenNotBeInDescendingOrder are not provided because it will significantly complicate the change. The issue is the following lines of Execute.Assertion
.ForCondition(!unordered.SequenceEqual(expectation))
.BecauseOf(because, becauseArgs)
.FailWith("Expected {context:collection} {0} to not be ordered {1}{reason} and not result in {2}.",
Subject, orderString, expectation);It would be much more complex than just |
dennisdoomen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Nice work.
❌ Please update the title to be functional
| namespace FluentAssertions.Collections | ||
| { | ||
| [DebuggerNonUserCode] | ||
| public class SubsequentOrderingGenericCollectionAssertions<T> : |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔧 Maybe rename it to SubsequentOrderingAssertions?
docs/_pages/releases.md
Outdated
| * Added `ComparingBy{Members,Value}(Type)` to allow specifying open generic types - [#1389](https://github.com/fluentassertions/fluentassertions/pull/1389). | ||
| * Added overload of `CollectionAssertions.NotBeEquivalentTo` that takes a `config` parameter` - [#1408](https://github.com/fluentassertions/fluentassertions/pull/1408). | ||
| * Changed `StringAssertions.StartWith`, `StringAssertions.EndWith` and their `EquivalentOf` versions to allow empty strings - [#1413](https://github.com/fluentassertions/fluentassertions/pull/1413). | ||
| * Added ThenBeInAscendingOrder and ThenBeInDescendingOrder to allow asserting that a subsequence is ordered in ascending or descending order - [#1416](https://github.com/fluentassertions/fluentassertions/pull/1416). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙃 Would be nice to format those names using back-ticks.
| #region Then be in order | ||
|
|
||
| [Fact] | ||
| public void When_asserting_subsequence_by_then_be_in_ascending_order_it_should_pass() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 Try to keep the names of test functional and never refer to the literal name of a method or API, e.g.
When_the_collection_is_ordered_according_to_the_subsequent_ordering_assertion_it_should_succeed
jnyrup
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this support multiple ThenBeInAscendingOrder?
E.g.
collection.Should()
.BeInAscendingOrder(x => x.Item1)
.And
.ThenBeInAscendingOrder(x => x.Item2)
.And
.ThenBeInAscendingOrder(x => x.Item3);
Tests/FluentAssertions.Specs/Collections/GenericCollectionAssertionsSpecs.cs
Show resolved
Hide resolved
|
Applied the notes and added two tests showing multiple |
IMPORTANT
AcceptApiChanges.ps1/AcceptApiChanges.sh.Issue #1160