@@ -27,25 +27,26 @@ public class MultipleRegistriesTests
27
27
[ Fact ]
28
28
public void TestSerialization ( )
29
29
{
30
- // At the moment having this uncommented would make the test fail due to the static caching of class maps
31
- // {
32
- // var client = DriverTestConfiguration.CreateMongoClient();
33
- // var db = client.GetDatabase(DriverTestConfiguration.DatabaseNamespace.DatabaseName);
34
- // db.DropCollection(DriverTestConfiguration.CollectionNamespace.CollectionName);
35
- // var collection = db.GetCollection<Person>(DriverTestConfiguration.CollectionNamespace.CollectionName);
36
- // var bsonCollection =
37
- // db.GetCollection<BsonDocument>(DriverTestConfiguration.CollectionNamespace.CollectionName);
38
- //
39
- // var person = new Person { Id = ObjectId.Parse("6797b56bf5495bf53aa3078f"), Name = "Mario", Age = 24 };
40
- // collection.InsertOne(person);
41
- //
42
- // var retrieved = bsonCollection.FindSync("{}").ToList().Single();
43
- // var toString = retrieved.ToString();
44
- //
45
- // var expectedVal =
46
- // """{ "_id" : { "$oid" : "6797b56bf5495bf53aa3078f" }, "Name" : "Mario", "Age" : 24 }""";
47
- // Assert.Equal(expectedVal, toString);
48
- // }
30
+ {
31
+ var client = DriverTestConfiguration . CreateMongoClient ( ) ;
32
+ var db = client . GetDatabase ( DriverTestConfiguration . DatabaseNamespace . DatabaseName ) ;
33
+ db . DropCollection ( DriverTestConfiguration . CollectionNamespace . CollectionName ) ;
34
+ var collection = db . GetCollection < Person > ( DriverTestConfiguration . CollectionNamespace . CollectionName ) ;
35
+ var bsonCollection =
36
+ db . GetCollection < BsonDocument > ( DriverTestConfiguration . CollectionNamespace . CollectionName ) ;
37
+
38
+ var person = new Person { Id = ObjectId . Parse ( "6797b56bf5495bf53aa3078f" ) , Name = "Mario" , Age = 24 } ;
39
+ collection . InsertOne ( person ) ;
40
+
41
+ var retrieved = bsonCollection . FindSync ( "{}" ) . ToList ( ) . Single ( ) ;
42
+ var toString = retrieved . ToString ( ) ;
43
+
44
+ var expectedVal =
45
+ """{ "_id" : { "$oid" : "6797b56bf5495bf53aa3078f" }, "Name" : "Mario", "Age" : 24 }""" ;
46
+ Assert . Equal ( expectedVal , toString ) ;
47
+ }
48
+
49
+ //The first section demonstrates that the class maps are also separated
49
50
50
51
{
51
52
var customDomain = BsonSerializer . CreateDomain ( ) ;
0 commit comments