public void TestTwoDateTimes() { var document = new BsonDocument(); using (var writer = new BsonDocumentWriter(document)) { writer.WriteStartDocument(); writer.WriteDateTime("a", 0); writer.WriteDateTime("b", 0); writer.WriteEndDocument(); } var json = document.ToJson(); var expected = "{ 'a' : ISODate('1970-01-01T00:00:00Z'), 'b' : ISODate('1970-01-01T00:00:00Z') }".Replace("'", "\""); ; Assert.Equal(expected, json); }
public void TestOneNestedDateTime() { var document = new BsonDocument(); using (var writer = new BsonDocumentWriter(document)) { writer.WriteStartDocument(); writer.WriteStartDocument("nested"); writer.WriteDateTime("a", 0); writer.WriteEndDocument(); writer.WriteEndDocument(); } var json = document.ToJson(); var expected = "{ 'nested' : { 'a' : ISODate('1970-01-01T00:00:00Z') } }".Replace("'", "\""); Assert.AreEqual(expected, json); }