File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -267,5 +267,37 @@ public void GetEnumeratorMethodsInLibGit2SharpMustBeVirtualForTestability()
267267 Assert . True ( false , Environment . NewLine + sb . ToString ( ) ) ;
268268 }
269269 }
270+
271+ [ Fact ]
272+ public void NoPublicTypesUnderLibGit2SharpCoreNamespace ( )
273+ {
274+ const string coreNamespace = "LibGit2Sharp.Core" ;
275+
276+ var types = Assembly . GetAssembly ( typeof ( IRepository ) )
277+ . GetExportedTypes ( )
278+ . Where ( t => t . FullName . StartsWith ( coreNamespace + "." ) )
279+
280+ // Ugly hack to circumvent a Mono bug
281+ // cf. https://bugzilla.xamarin.com/show_bug.cgi?id=27010
282+ . Where ( t => ! t . FullName . Contains ( "+" ) )
283+
284+ #if LEAKS_IDENTIFYING
285+ . Where ( t => t != typeof ( LibGit2Sharp . Core . LeaksContainer ) )
286+ #endif
287+ . ToList ( ) ;
288+
289+ if ( types . Any ( ) )
290+ {
291+ var sb = new StringBuilder ( ) ;
292+
293+ foreach ( var type in types )
294+ {
295+ sb . AppendFormat ( "Public type '{0}' under the '{1}' namespace.{2}" ,
296+ type . FullName , coreNamespace , Environment . NewLine ) ;
297+ }
298+
299+ Assert . True ( false , Environment . NewLine + sb . ToString ( ) ) ;
300+ }
301+ }
270302 }
271303}
You can’t perform that action at this time.
0 commit comments