Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-173

On mono, BsonDateTime.Value does not respect timezones.

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.0
    • Affects Version/s: 0.11
    • Component/s: None
    • None
    • Environment:
      Ubuntu Mono JIT compiler version 2.6.7 (Debian 2.6.7-3ubuntu1

      I get the following failed test:
      MongoDB.BsonUnitTests.BsonTypeMapperTests.TestMapString:
      Expected: 2010-01-02 00:00:00.000
      But was: 2010-01-02 05:00:00.000

      This fixes the test on mono (run through nunit-console). Its probably not the right answer:

      zippy@maya-gwapa:~/src/mongo-csharp$ git diff
      diff --git a/BsonUnitTests/ObjectModel/BsonTypeMapperTests.cs b/BsonUnitTests/ObjectModel/BsonTypeMapperTests.cs
      index c5f0a28..a2133b5 100644
      — a/BsonUnitTests/ObjectModel/BsonTypeMapperTests.cs
      +++ b/BsonUnitTests/ObjectModel/BsonTypeMapperTests.cs
      @@ -457,7 +457,7 @@ namespace MongoDB.BsonUnitTests {
      var bsonBoolean = (BsonBoolean) BsonTypeMapper.MapToBsonValue("1", BsonType.Boolean);
      Assert.AreEqual(true, bsonBoolean.Value);
      var bsonDateTime = (BsonDateTime) BsonTypeMapper.MapToBsonValue("2010-01-02", BsonType.DateTime);

      • Assert.AreEqual(new DateTime(2010, 1, 2), bsonDateTime.Value);
        + Assert.AreEqual(new DateTime(2010, 1, 2), bsonDateTime.Value.ToLocalTime());
        var bsonDouble = (BsonDouble) BsonTypeMapper.MapToBsonValue("1.2", BsonType.Double);
        Assert.AreEqual(1.2, bsonDouble.Value);
        var bsonInt32 = (BsonInt32) BsonTypeMapper.MapToBsonValue("1", BsonType.Int32);

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            zippy1981 Justin Dearing
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: