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
BeInDescendingOrder does not validate correctly the order of a list of strings #2126
Comments
Since 6.9.0, by default, we order strings using an ordinal string comparison because we received bug reports where people were using different cultures without even realizing. There's an overload that takes an |
@dennisdoomen I don't want to reopen not argue with the decision made, but I would like to share my point of view. Ignoring the technicalities, by default for dotnet and SQL server the array ordered ["Z", "v", "a", "1"], is the correct descending order. I hope you see my point. |
Yeah, it's a trade-off. In #2075, we noticed that our tests started to fail depending on the operating system culture of whoever was running our tests. We could have solved that by fixing the culture for all tests to for example |
This is definitely a wide and complex issue, as I said I am not arguing, we need to document it clearly also through the method comments (for the intellisense). |
Those two PRs are enforcing what culture FA is running its build and tests under. We should not be messing with the culture of consumers. |
Given that statement, why would we use ordinal comparisons then? We don't need it anymore to prevent contributors from having to deal with failing tests in FA. |
The thought was to ensure that consumer test outcomes do not change between local and CI runs where culture often changes. |
Description
This is the first time I try to use 'BeInDescendingOrder' and I am getting an unexpected behaviour.
It seems to be failing when the list is actually correctly ordered.
Reproduction Steps
JSFiddle to reproduce the issue and demonstrate that using 'CompareTo' does work and the list is in the correct order.
https://dotnetfiddle.net/cODDFk
Expected behavior
I would expect the 'BeInDescendingOrder' to succeed when verifying a list of strings ordered using linq.
Actual behavior
Currently with the test data I get a validation failure when trying to process a list of strings correctly ordered
Regression?
No response
Known Workarounds
No response
Configuration
Using .net 6
Other information
No response
The text was updated successfully, but these errors were encountered: