File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
Serilog.Ui.MongoDbProvider.Tests/Util/Builders Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 1717 <PackageReference Include =" Microsoft.Extensions.Logging.Abstractions" Version =" 6.0.3" />
1818 <PackageReference Include =" MySql.Data" Version =" 8.0.23" />
1919 <PackageReference Include =" Npgsql" Version =" 6.0.9" />
20- <PackageReference Include =" Newtonsoft.Json" Version =" 13.0.1 " />
20+ <PackageReference Include =" Newtonsoft.Json" Version =" 13.0.2 " />
2121 <PackageReference Include =" Serilog" Version =" 2.12.0" />
2222 <PackageReference Include =" Testcontainers" Version =" 3.0.0" />
2323 <PackageReference Include =" xunit.extensibility.core" Version =" 2.4.2" />
Original file line number Diff line number Diff line change 1- using MongoDB . Driver ;
1+ using MongoDB . Bson . Serialization ;
2+ using MongoDB . Bson . Serialization . Serializers ;
3+ using MongoDB . Driver ;
24using Serilog . Ui . Common . Tests . DataSamples ;
35using Serilog . Ui . MongoDbProvider ;
46using System . Threading . Tasks ;
@@ -28,6 +30,15 @@ public static async Task<MongoDbDataProviderBuilder> Build(bool useLinq3)
2830 public static async Task < LogModelPropsCollector > Seed ( IMongoCollection < MongoDbLogModel > collection )
2931 {
3032 var ( array , collector ) = MongoDbLogModelFaker . Logs ( 100 ) ;
33+
34+ // https://stackoverflow.com/a/75637412/15129749
35+ var objectSerializer = new ObjectSerializer ( type => ObjectSerializer . DefaultAllowedTypes ( type ) ||
36+ type . FullName . StartsWith ( "Serilog.Ui.Common.Tests" ) ||
37+ type . FullName . StartsWith ( "MongoDB.Bson.BsonDocument" )
38+
39+ ) ;
40+ BsonSerializer . RegisterSerializer ( objectSerializer ) ;
41+
3142 await collection . InsertManyAsync ( array ) ;
3243 return collector ;
3344 }
You can’t perform that action at this time.
0 commit comments