1919using MongoDB . Driver . Core ;
2020using MongoDB . Driver . Core . Clusters ;
2121using MongoDB . Driver . Core . Configuration ;
22+ using MongoDB . Driver . Linq ;
2223using MongoDB . Driver . TestHelpers ;
2324
2425namespace MongoDB . Driver . Tests
@@ -34,6 +35,7 @@ public static class DriverTestConfiguration
3435 private static CollectionNamespace __collectionNamespace ;
3536 private static DatabaseNamespace __databaseNamespace ;
3637 private static Lazy < IReadOnlyList < IMongoClient > > __directClientsToShardRouters ;
38+ private static Lazy < MongoClient > __linq3Client ;
3739
3840 // static constructor
3941 static DriverTestConfiguration ( )
@@ -45,6 +47,7 @@ static DriverTestConfiguration()
4547 ( ) => CreateDirectClientsToHostsInConnectionString ( CoreTestConfiguration . ConnectionStringWithMultipleShardRouters ) . ToList ( ) . AsReadOnly ( ) ,
4648 isThreadSafe : true ) ;
4749 __collectionNamespace = new CollectionNamespace ( __databaseNamespace , "testcollection" ) ;
50+ __linq3Client = new Lazy < MongoClient > ( CreateLinq3Client , isThreadSafe : true ) ;
4851 }
4952
5053 // public static properties
@@ -94,6 +97,14 @@ public static DatabaseNamespace DatabaseNamespace
9497 get { return __databaseNamespace ; }
9598 }
9699
100+ /// <summary>
101+ /// Gets the LINQ3 test client.
102+ /// </summary>
103+ public static MongoClient Linq3Client
104+ {
105+ get { return __linq3Client . Value ; }
106+ }
107+
97108 // public static methods
98109 public static IEnumerable < IMongoClient > CreateDirectClientsToServersInClientSettings ( MongoClientSettings settings )
99110 {
@@ -165,6 +176,13 @@ public static DisposableMongoClient CreateDisposableClient(MongoClientSettings s
165176 return new DisposableMongoClient ( new MongoClient ( settings ) ) ;
166177 }
167178
179+ private static MongoClient CreateLinq3Client ( )
180+ {
181+ var linq3ClientSettings = Client . Settings . Clone ( ) ;
182+ linq3ClientSettings . LinqProvider = LinqProvider . V3 ;
183+ return new MongoClient ( linq3ClientSettings ) ;
184+ }
185+
168186 public static MongoClientSettings GetClientSettings ( )
169187 {
170188 var connectionString = CoreTestConfiguration . ConnectionString . ToString ( ) ;
0 commit comments