public void TestTwoNestedTimestamps() { var document = new BsonDocument(); using (var writer = new BsonDocumentWriter(document)) { writer.WriteStartDocument(); writer.WriteStartDocument("nested"); writer.WriteTimestamp("a", 1); writer.WriteTimestamp("b", 2); writer.WriteEndDocument(); writer.WriteEndDocument(); } var json = document.ToJson(); var expected = "{ 'nested' : { 'a' : Timestamp(0, 1), 'b' : Timestamp(0, 2) } }".Replace("'", "\""); Assert.Equal(expected, json); }
public void TestOneTimestamp() { var document = new BsonDocument(); using (var writer = new BsonDocumentWriter(document)) { writer.WriteStartDocument(); writer.WriteTimestamp("a", 1); writer.WriteEndDocument(); } var json = document.ToJson(); var expected = "{ 'a' : Timestamp(0, 1) }".Replace("'", "\""); ; Assert.Equal(expected, json); }
public void TestTwoTimestamps() { var document = new BsonDocument(); using (var writer = new BsonDocumentWriter(document)) { writer.WriteStartDocument(); writer.WriteTimestamp("a", 1); writer.WriteTimestamp("b", 2); writer.WriteEndDocument(); } var json = document.ToJson(); var expected = "{ 'a' : { '$timestamp' : NumberLong(1) }, 'b' : { '$timestamp' : NumberLong(2) } }".Replace("'", "\""); ; Assert.AreEqual(expected, json); }