public void TestOneUndefined() { var document = new BsonDocument(); using (var writer = new BsonDocumentWriter(document)) { writer.WriteStartDocument(); writer.WriteUndefined("a"); writer.WriteEndDocument(); } var json = document.ToJson(); var expected = "{ 'a' : undefined }".Replace("'", "\""); ; Assert.Equal(expected, json); }
public void TestTwoNestedUndefineds() { var document = new BsonDocument(); using (var writer = new BsonDocumentWriter(document)) { writer.WriteStartDocument(); writer.WriteStartDocument("nested"); writer.WriteUndefined("a"); writer.WriteUndefined("b"); writer.WriteEndDocument(); writer.WriteEndDocument(); } var json = document.ToJson(); var expected = "{ 'nested' : { 'a' : undefined, 'b' : undefined } }".Replace("'", "\""); Assert.AreEqual(expected, json); }