19
19
using MongoDB . Driver . Core ;
20
20
using MongoDB . Driver . Core . Clusters ;
21
21
using MongoDB . Driver . Core . Configuration ;
22
+ using MongoDB . Driver . Linq ;
22
23
using MongoDB . Driver . TestHelpers ;
23
24
24
25
namespace MongoDB . Driver . Tests
@@ -34,6 +35,7 @@ public static class DriverTestConfiguration
34
35
private static CollectionNamespace __collectionNamespace ;
35
36
private static DatabaseNamespace __databaseNamespace ;
36
37
private static Lazy < IReadOnlyList < IMongoClient > > __directClientsToShardRouters ;
38
+ private static Lazy < MongoClient > __linq3Client ;
37
39
38
40
// static constructor
39
41
static DriverTestConfiguration ( )
@@ -45,6 +47,7 @@ static DriverTestConfiguration()
45
47
( ) => CreateDirectClientsToHostsInConnectionString ( CoreTestConfiguration . ConnectionStringWithMultipleShardRouters ) . ToList ( ) . AsReadOnly ( ) ,
46
48
isThreadSafe : true ) ;
47
49
__collectionNamespace = new CollectionNamespace ( __databaseNamespace , "testcollection" ) ;
50
+ __linq3Client = new Lazy < MongoClient > ( CreateLinq3Client , isThreadSafe : true ) ;
48
51
}
49
52
50
53
// public static properties
@@ -94,6 +97,14 @@ public static DatabaseNamespace DatabaseNamespace
94
97
get { return __databaseNamespace ; }
95
98
}
96
99
100
+ /// <summary>
101
+ /// Gets the LINQ3 test client.
102
+ /// </summary>
103
+ public static MongoClient Linq3Client
104
+ {
105
+ get { return __linq3Client . Value ; }
106
+ }
107
+
97
108
// public static methods
98
109
public static IEnumerable < IMongoClient > CreateDirectClientsToServersInClientSettings ( MongoClientSettings settings )
99
110
{
@@ -165,6 +176,13 @@ public static DisposableMongoClient CreateDisposableClient(MongoClientSettings s
165
176
return new DisposableMongoClient ( new MongoClient ( settings ) ) ;
166
177
}
167
178
179
+ private static MongoClient CreateLinq3Client ( )
180
+ {
181
+ var linq3ClientSettings = Client . Settings . Clone ( ) ;
182
+ linq3ClientSettings . LinqProvider = LinqProvider . V3 ;
183
+ return new MongoClient ( linq3ClientSettings ) ;
184
+ }
185
+
168
186
public static MongoClientSettings GetClientSettings ( )
169
187
{
170
188
var connectionString = CoreTestConfiguration . ConnectionString . ToString ( ) ;
0 commit comments