Use Ordinal[IgnoreCase] string comparison by jnyrup · Pull Request #1283 · fluentassertions/fluentassertions · GitHub
Skip to content

Use Ordinal[IgnoreCase] string comparison#1283

Merged
jnyrup merged 1 commit into
fluentassertions:developfrom
jnyrup:Culture
Mar 29, 2020
Merged

Use Ordinal[IgnoreCase] string comparison#1283
jnyrup merged 1 commit into
fluentassertions:developfrom
jnyrup:Culture

Conversation

@jnyrup

@jnyrup jnyrup commented Mar 29, 2020

Copy link
Copy Markdown
Member

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.

@dennisdoomen dennisdoomen left a comment

Copy link
Copy Markdown
Member

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

jnyrup commented Mar 29, 2020

Copy link
Copy Markdown
Member Author

@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