BeLowerCased() results in failing tests with only lower case characters.
See original GitHub issueDescription
Just introduced using BeLowerCased()
into one of our tests where we want to assert that a file path is lower case, but the result is not as expected. The response I get from the failing test is as follows:
Expected all characters in carFolderPath to be lower cased, but found "\files\f7f9de7c-90f4-46a3-9ceb-97af53f495e3\carfiles\abc123".
Perhaps the back slash is considered an upper case character in some way?
Complete minimal example reproducing the issue
// Arrange
var input = @"\test\with\lower\cased\string";
// Assert
input.Should().BeLowerCased();
Expected behavior:
Test to pass
Actual behavior:
Test fails
Versions
Fluentassertions: 6.3.0 .NET 5
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Improving Unit Tests with Fluent Assertions
BeLoweredCased() and BeUpperCased() will test if the SUT is comprised of all lower or upper case characters. Conversely, there are also 'Not' ...
Read more >Strings
For asserting whether a string is null, empty, contains whitespace only, or is in upper/lower case, you have a wide range of methods...
Read more >how to check if a string contains only lower case letters and ...
You can use isdigit() or islower() method to check string contains only numbers and lower case letters import string input_str=raw_input() ...
Read more >Fluent Assertions: Fluently Assert the Result of .NET Tests
Numbers and special characters do not have casing, so BeUpperCased and BeLowerCased will always fail on a string that contains anything but ...
Read more >Google | Screening - LeetCode Discuss
Problem: Given an input string, return an output string such that all the lower case characters should be sorted. Indices of non-lower case...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Let’s keep it open so we update the documentation.
NotBeUpperCased
does the trick in this case, however not completely clear by the description of the function that this is how it works.I thought that anything that for instance had been
ToLower
:ed would also be asserted as ok byBeLowerCased
. So for instance, a silly example:Thanks for pointing me in the right direction regarding
NotBeUpperCased