Skip to content
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

Unit Tests break when launched on environment with a default culture different than en-US #259

Closed
MrJingle opened this issue May 24, 2014 · 1 comment

Comments

@MrJingle
Copy link
Contributor

If you set the system Date and Time format to Italian( or any other culture with a different date format than MM/dd/yyyy) the type initializer for NorthWindData will throw an exception on:

[...]
HireDate = ParseDate("8/14/1992 12:00:00 AM"), // the default it-IT date time format is dd/MM/yyyy
[..]

Exception details:

Test Name:  Any_simple
Test FullName:  Microsoft.Data.Entity.InMemory.FunctionalTests.NorthwindQueryTest.Any_simple
Test Source:    d:\MrJingle\Dev\Git\Forks\EntityFramework7\test\Shared\NorthwindQueryTestBase.cs : line 54
Test Outcome:   Failed
Test Duration:  0:00:00,001

Result Message: 
System.AggregateException : One or more errors occurred.
---- System.TypeInitializationException : The type initializer for 'Northwind.NorthwindData' threw an exception.
-------- System.FormatException : String was not recognized as a valid DateTime.
---- The following constructor arguments did not have matching fixture data: NorthwindQueryFixture fixture
Result StackTrace:  
----- Inner Stack Trace #1 (System.TypeInitializationException) -----
   at Microsoft.Data.Entity.InMemory.FunctionalTests.NorthwindQueryFixture..ctor() in d:\MrJingle\Dev\Git\Forks\EntityFramework7\test\Microsoft.Data.Entity.InMemory.FunctionalTests\NorthwindQueryTest.cs:line 39
----- Inner Stack Trace -----
   at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
   at System.DateTime.Parse(String s)
   at Northwind.NorthwindData.ParseDate(String date) in d:\MrJingle\Dev\Git\Forks\EntityFramework7\test\Shared\Northwind.cs:line 303
   at Northwind.NorthwindData..cctor() in d:\MrJingle\Dev\Git\Forks\EntityFramework7\test\Shared\ **Northwind.cs:line 1590**
----- Inner Stack Trace #2 (Xunit.Sdk.TestClassException) -----

I've opened a pull request(#258) with the changes that fix the issue.

You can merge it or, if you can't accept contributions yet, simply use it as a reference (it is really a simple fix).

I hope is useful to others,
Thanks.

@rowanmiller
Copy link
Contributor

Dupe of #182

@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
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

No branches or pull requests

3 participants