1- using System ;
2- using System . Linq ;
3- using System . Reflection ;
1+ using System . Linq ;
42using System . Threading . Tasks ;
53using NUnit . Framework ;
64
7- namespace Shuttle . Core . Reflection . Tests
5+ namespace Shuttle . Core . Reflection . Tests ;
6+
7+ [ TestFixture ]
8+ public class ReflectionServiceFixture
89{
9- [ TestFixture ]
10- public class ReflectionServiceFixture
10+ [ Test ]
11+ public async Task Should_be_able_to_get_runtime_assemblies_async ( )
1112 {
12- [ Test ]
13- public void Should_be_able_to_get_runtime_assemblies ( )
14- {
15- Assert . That ( new ReflectionService ( ) . GetRuntimeAssemblies ( ) . Count ( ) , Is . GreaterThan ( 0 ) ) ;
16- }
17-
18- [ Test ]
19- public async Task Should_be_able_to_get_runtime_assemblies_async ( )
20- {
21- Assert . That ( ( await new ReflectionService ( ) . GetRuntimeAssembliesAsync ( ) ) . Count ( ) , Is . GreaterThan ( 0 ) ) ;
22- }
23-
24- [ Test ]
25- public void Should_be_able_to_get_types ( )
26- {
27- Assert . That ( new ReflectionService ( ) . GetTypesAssignableTo < SomeClass > ( ) . Count ( ) , Is . EqualTo ( 1 ) ) ;
28- Assert . That ( new ReflectionService ( ) . GetTypesAssignableTo < ISomeClass > ( ) . Count ( ) , Is . EqualTo ( 1 ) ) ;
29- }
30-
31- [ Test ]
32- public async Task Should_be_able_to_get_types_async ( )
33- {
34- Assert . That ( ( await new ReflectionService ( ) . GetTypesAssignableToAsync < SomeClass > ( ) ) . Count ( ) , Is . EqualTo ( 1 ) ) ;
35- Assert . That ( ( await new ReflectionService ( ) . GetTypesAssignableToAsync < ISomeClass > ( ) ) . Count ( ) , Is . EqualTo ( 1 ) ) ;
36- }
13+ Assert . That ( ( await new ReflectionService ( ) . GetRuntimeAssembliesAsync ( ) ) . Count ( ) , Is . GreaterThan ( 0 ) ) ;
14+ }
3715
38- [ Test ]
39- public void Should_be_able_to_get_matching_assemblies ( )
40- {
41- var service = new ReflectionService ( ) ;
16+ [ Test ]
17+ public async Task Should_be_able_to_get_types_async ( )
18+ {
19+ Assert . That ( ( await new ReflectionService ( ) . GetTypesAssignableToAsync < SomeClass > ( ) ) . Count ( ) , Is . EqualTo ( 1 ) ) ;
20+ Assert . That ( ( await new ReflectionService ( ) . GetTypesAssignableToAsync < ISomeClass > ( ) ) . Count ( ) , Is . EqualTo ( 1 ) ) ;
21+ }
4222
43- Assert . That ( service . GetMatchingAssemblies ( ".+" ) . Count ( ) , Is . GreaterThan ( 0 ) ) ;
23+ public async Task Should_be_able_to_get_matching_assemblies_async ( )
24+ {
25+ var service = new ReflectionService ( ) ;
4426
45- foreach ( var assembly in service . GetMatchingAssemblies ( "nunit" ) )
46- {
47- Assert . That ( assembly . FullName . Contains ( "nunit" ) ) ;
48- }
49- }
27+ Assert . That ( ( await service . GetMatchingAssembliesAsync ( ".+" ) ) . Count ( ) , Is . GreaterThan ( 0 ) ) ;
5028
51- public async Task Should_be_able_to_get_matching_assemblies_async ( )
29+ foreach ( var assembly in await service . GetMatchingAssembliesAsync ( "nunit" ) )
5230 {
53- var service = new ReflectionService ( ) ;
54-
55- Assert . That ( ( await service . GetMatchingAssembliesAsync ( ".+" ) ) . Count ( ) , Is . GreaterThan ( 0 ) ) ;
56-
57- foreach ( var assembly in ( await service . GetMatchingAssembliesAsync ( "nunit" ) ) )
58- {
59- Assert . That ( assembly . FullName . Contains ( "nunit" ) ) ;
60- }
31+ Assert . That ( assembly . FullName ! . Contains ( "nunit" ) ) ;
6132 }
6233 }
6334}
0 commit comments