exercism / csharp

Exercism exercises in C#.
https://exercism.org/tracks/csharp
MIT License
347 stars 346 forks source link

Ledger Exercise #1373

Open h2oboi89 opened 4 years ago

h2oboi89 commented 4 years ago

Ledger exercise tests fail upon initial download if PC locale settings (en-US) are different than default.

Given this is a refactoring exercise they should initially pass if I am not mistaken.

robkeim commented 4 years ago

Hello @h2oboi89!

Thanks for reporting this issue. You're correct that all of the tests should pass since the exercise is focused on refactoring existing code that is working.

Could you please give us more details on the error that you're receiving when you try to run the tests? That will help us understand the issue better.

h2oboi89 commented 4 years ago

I changed my date and time settings. Default uses / as date separator IIRC, I switched to -.

As a result, if I attempt to use the en-US culture without explicitly setting everything to match the tests a lot of the tests fail, even right out of the box when they are supposed to pass.

To get around this I avoid using either the nl-NL or en-US cultures and created my own Ledger culture (le-LE). Link to solution

Example:

Expected: ···  | Change       \n01/01/2015 | Freude schoner Gotterf... |   ···
Actual:   ···  | Change       \n01-01-2015 | Freude schoner Gotterf... |   ···
Test Run Failed.
Total tests: 10
     Passed: 3
     Failed: 7

That was the result of modifying my code to use the en-US culture again instead of the le-LE culture I made up. I believe I had similar results the first time I ran all the tests with the original code.

h2oboi89 commented 4 years ago

Based on the two cultures used (en-US and nl-NL) only people who natively use either of those cultures and have modified the culture settings used in the Ledger exercise should be affected by this issue.

robkeim commented 4 years ago

Thanks for the clarification. Given the percentage of users that change their culture settings that probably explains why we've never seen this issue reported before.