Skip to content

Conversation

@jnyrup
Copy link
Member

@jnyrup jnyrup commented Mar 29, 2020

Unit tests should behave the same no matter the culture of the machine being run on.

As netcoreapp2.1/netcoreapp3.0/netstandard2.1 has more string overloads than net47/netstandard2.0 I added some dummy overloads in SystemExtensions to satisfy the analyzers.

One large difference in behavior is that TryConversionStep now uses CultureInfo.Invariant instead of CultureInfo.CurrentCulture.

This fixes #1096
This closes #1184 (Thanks @kimsey0 for pushing this change forward)

Unit tests should behave the same no matter the culture of the machine being run on.
Copy link
Member

@dennisdoomen dennisdoomen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So using ordinal case-insensitive for string comparisons should be another design guideline. Maybe we should add them to the PR template?

@jnyrup
Copy link
Member Author

jnyrup commented Mar 29, 2020

So using ordinal case-insensitive for string comparisons should be another design guideline. Maybe we should add them to the PR template?

Would fine be.
Nevertheless one should get a compile time error now if trying due to

  • CA1304: Specify CultureInfo
  • CA1307: Specify StringComparison
  • CA1308: Normalize strings to uppercase
  • CA1309: Use ordinal StringComparison

@jnyrup jnyrup merged commit c09eed4 into fluentassertions:develop Mar 29, 2020
@jnyrup jnyrup deleted the Culture branch March 29, 2020 15:16
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 this pull request may close these issues.

String .BeEquivalentTo() is case-sensitive on linux

2 participants