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)
264264 throw new NotSupportedException ( "Only field and properties are supported at this time." ) ;
265265 }
266266
267+ /// <summary>
268+ /// Returns all registered class maps.
269+ /// </summary>
270+ public static IEnumerable < BsonClassMap > GetRegisteredClassMaps ( )
271+ {
272+ return __classMaps . Values ;
273+ }
274+
267275 /// <summary>
268276 /// Checks whether a class map is registered for a type.
269277 /// </summary>
@@ -287,14 +295,6 @@ public static bool IsClassMapRegistered(Type type)
287295 }
288296 }
289297
290- /// <summary>
291- /// Returns all registered class maps.
292- /// </summary>
293- public static IEnumerable < BsonClassMap > AllClassMaps ( )
294- {
295- return __classMaps . Values ;
296- }
297-
298298 /// <summary>
299299 /// Looks up a class map (will AutoMap the class if no class map is registered).
300300 /// </summary>
Original file line number Diff line number Diff line change @@ -310,10 +310,8 @@ public void TestIsClassMapRegistered()
310310 }
311311
312312 [ TestFixture ]
313- public class BsonClassMapAllClassMapTests
313+ public class BsonClassMapGetRegisteredClassMapTests
314314 {
315- private static bool __testAlreadyRan ;
316-
317315 public class C
318316 {
319317 public ObjectId Id ;
@@ -327,22 +325,14 @@ public class D
327325 }
328326
329327 [ Test ]
330- public void TestAllClassMaps ( )
328+ public void TestGetRegisteredClassMaps ( )
331329 {
332- // test can only be run once
333- if ( __testAlreadyRan )
334- {
335- return ;
336- }
337-
338- __testAlreadyRan = true ;
339-
340330 Assert . IsFalse ( BsonClassMap . IsClassMapRegistered ( typeof ( C ) ) ) ;
341331 Assert . IsFalse ( BsonClassMap . IsClassMapRegistered ( typeof ( D ) ) ) ;
342332 BsonClassMap . RegisterClassMap < C > ( cm => cm . AutoMap ( ) ) ;
343333 BsonClassMap . RegisterClassMap < D > ( cm => cm . AutoMap ( ) ) ;
344334
345- var classMaps = BsonClassMap . AllClassMaps ( ) ;
335+ var classMaps = BsonClassMap . GetRegisteredClassMaps ( ) ;
346336 var classMapTypes = classMaps . Select ( x => x . ClassType ) . ToList ( ) ;
347337
348338 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
3838* Andrew Rondeau github@andrewrondeau.com
3939* Ed Rooth edward.rooth@wallstreetjapan.com
4040* Testo test1@doramail.com
41+ * Alex Brown https://github.com/alexjamesbrown
4142
4243If 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