mbdavid / LiteDB

LiteDB - A .NET NoSQL Document Store in a single data file
http://www.litedb.org
MIT License
8.36k stars 1.22k forks source link

[BUG] Tests about `DAY()` fails in Japan Standard Time #2414

Open anatawa12 opened 5 months ago

anatawa12 commented 5 months ago

Version Which LiteDB version/OS/.NET framework version are you using. (REQUIRED)

Describe the bug A clear and concise description of what the bug is.

DAY MONTH YEAR is timezone dependent so this test fails in JST

https://github.com/mbdavid/LiteDB/blob/aff0bd844d032b13dfff4c4e2c0ac18e674b13d9/LiteDB.Tests/Expressions/Expressions_Exec_Tests.cs#L215

Steps to Reproduce

  1. configure your pc to Japan Standard Time
  2. dotnet test

Expected behavior A clear and concise description of what you expected to happen. No test failure

Screenshots/Stacktrace If applicable, add screenshots/stacktrace

[xUnit.net 00:00:01.26]     LiteDB.Tests.Expressions.ExpressionsExec_Tests.Expressions_Scalar_Methods [FAIL]
  Failed LiteDB.Tests.Expressions.ExpressionsExec_Tests.Expressions_Scalar_Methods [244 ms]
  Error Message:
   Expected value to be equal to 1, but found 2.
  Stack Trace:
     at FluentAssertions.Execution.XUnit2TestFramework.Throw(String message)
   at FluentAssertions.Execution.TestFrameworkProvider.Throw(String message)
   at FluentAssertions.Execution.DefaultAssertionStrategy.HandleFailure(String message)
   at FluentAssertions.Execution.AssertionScope.FailWith(Func`1 failReasonFunc)
   at FluentAssertions.Execution.AssertionScope.FailWith(Func`1 failReasonFunc)
   at FluentAssertions.Execution.AssertionScope.FailWith(String message, Object[] args)
   at FluentAssertions.Numeric.ComparableTypeAssertions`1.Be(T expected, String because, Object[] becauseArgs)
   at LiteDB.Tests.AssertEx.ExpectValue(BsonValue value, BsonValue expect) in /Users/anatawa12/RiderProjects/LiteDB/LiteDB.Tests/Utils/AssertEx.cs:line 40
   at LiteDB.Tests.Expressions.ExpressionsExec_Tests.Expressions_Scalar_Methods() in /Users/anatawa12/RiderProjects/LiteDB/LiteDB.Tests/Expressions/Expressions_Exec_Tests.cs:line 215

Additional context Add any other context about the problem here.

I don't know if DAY YEAR and MONTH are expected to be timezone dependant or not but I think some applications depend on timezone dependant behavior so I assume this is bug of test, not of application