File tree Expand file tree Collapse file tree 3 files changed +12
-21
lines changed
BsonUnitTests/DefaultSerializer Expand file tree Collapse file tree 3 files changed +12
-21
lines changed Original file line number Diff line number Diff line change @@ -264,6 +264,14 @@ public static Type GetMemberInfoType(MemberInfo memberInfo)
264
264
throw new NotSupportedException ( "Only field and properties are supported at this time." ) ;
265
265
}
266
266
267
+ /// <summary>
268
+ /// Returns all registered class maps.
269
+ /// </summary>
270
+ public static IEnumerable < BsonClassMap > GetRegisteredClassMaps ( )
271
+ {
272
+ return __classMaps . Values ;
273
+ }
274
+
267
275
/// <summary>
268
276
/// Checks whether a class map is registered for a type.
269
277
/// </summary>
@@ -287,14 +295,6 @@ public static bool IsClassMapRegistered(Type type)
287
295
}
288
296
}
289
297
290
- /// <summary>
291
- /// Returns all registered class maps.
292
- /// </summary>
293
- public static IEnumerable < BsonClassMap > AllClassMaps ( )
294
- {
295
- return __classMaps . Values ;
296
- }
297
-
298
298
/// <summary>
299
299
/// Looks up a class map (will AutoMap the class if no class map is registered).
300
300
/// </summary>
Original file line number Diff line number Diff line change @@ -310,10 +310,8 @@ public void TestIsClassMapRegistered()
310
310
}
311
311
312
312
[ TestFixture ]
313
- public class BsonClassMapAllClassMapTests
313
+ public class BsonClassMapGetRegisteredClassMapTests
314
314
{
315
- private static bool __testAlreadyRan ;
316
-
317
315
public class C
318
316
{
319
317
public ObjectId Id ;
@@ -327,22 +325,14 @@ public class D
327
325
}
328
326
329
327
[ Test ]
330
- public void TestAllClassMaps ( )
328
+ public void TestGetRegisteredClassMaps ( )
331
329
{
332
- // test can only be run once
333
- if ( __testAlreadyRan )
334
- {
335
- return ;
336
- }
337
-
338
- __testAlreadyRan = true ;
339
-
340
330
Assert . IsFalse ( BsonClassMap . IsClassMapRegistered ( typeof ( C ) ) ) ;
341
331
Assert . IsFalse ( BsonClassMap . IsClassMapRegistered ( typeof ( D ) ) ) ;
342
332
BsonClassMap . RegisterClassMap < C > ( cm => cm . AutoMap ( ) ) ;
343
333
BsonClassMap . RegisterClassMap < D > ( cm => cm . AutoMap ( ) ) ;
344
334
345
- var classMaps = BsonClassMap . AllClassMaps ( ) ;
335
+ var classMaps = BsonClassMap . GetRegisteredClassMaps ( ) ;
346
336
var classMapTypes = classMaps . Select ( x => x . ClassType ) . ToList ( ) ;
347
337
348
338
Assert . IsTrue ( BsonClassMap . IsClassMapRegistered ( typeof ( C ) ) ) ;
Original file line number Diff line number Diff line change @@ -38,5 +38,6 @@ http://jira.mongodb.org/browse/CSHARP
38
38
* Andrew Rondeau
[email protected]
39
39
40
40
41
+ * Alex Brown https://github.com/alexjamesbrown
41
42
42
43
If you have contributed and we have neglected to add you to this list please contact one of the maintainers to be added to the list (with apologies).
You can’t perform that action at this time.
0 commit comments