Skip to content

Commit d3973e1

Browse files
committed
Added test and removed comment
1 parent 9ccfe7a commit d3973e1

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/MongoDB.Bson/Serialization/BsonClassMap.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ namespace MongoDB.Bson.Serialization
3232
public class BsonClassMap
3333
{
3434
// private static fields
35-
private readonly static Dictionary<Type, BsonClassMap> __classMaps = new Dictionary<Type, BsonClassMap>(); //TODO I think the static fields and methods should not be here, but on the domain
35+
private readonly static Dictionary<Type, BsonClassMap> __classMaps = new Dictionary<Type, BsonClassMap>();
3636
private readonly static Queue<Type> __knownTypesQueue = new Queue<Type>();
3737
private static int __freezeNestingLevel = 0;
3838

tests/MongoDB.Driver.Tests/MultipleRegistriesTests.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,15 @@ public void GeneralTest()
6161
var person = new Person { Id = ObjectId.Parse("6797b56bf5495bf53aa3078f"), Name = "Mario", Age = 24 };
6262
collection.InsertOne(person);
6363

64-
var retrieved = bsonCollection.FindSync("{}").ToList().Single();
65-
var toString = retrieved.ToString();
64+
var retrievedAsBson = bsonCollection.FindSync("{}").ToList().Single();
65+
var toString = retrievedAsBson.ToString();
6666

6767
var expectedVal =
6868
"""{ "_id" : { "$oid" : "6797b56bf5495bf53aa3078f" }, "Name" : "Mariotest", "Age" : 24 }""";
6969
Assert.Equal(expectedVal, toString);
70+
71+
var retrievedTyped = collection.FindSync("{}").ToList().Single();
72+
Assert.Equal("Mario", retrievedTyped.Name);
7073
}
7174
}
7275

@@ -89,8 +92,7 @@ protected override string DeserializeValue(BsonDeserializationContext context, B
8992
var bsonType = bsonReader.GetCurrentBsonType();
9093
return bsonType switch
9194
{
92-
BsonType.String => bsonReader.ReadString(),
93-
BsonType.Symbol => bsonReader.ReadSymbol(),
95+
BsonType.String => bsonReader.ReadString().Replace("test", ""),
9496
_ => throw CreateCannotDeserializeFromBsonTypeException(bsonType)
9597
};
9698
}

0 commit comments

Comments
 (0)