File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
RealTimeWeatherMonitoringTest/Presentation Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ using System . Reflection ;
2+ using FluentAssertions ;
3+ using RealTimeWeatherMonitoringApp . Application . Interfaces ;
4+ using RealTimeWeatherMonitoringApp . Presentation . Utility ;
5+ using Xunit ;
6+
7+ namespace RealTimeWeatherMonitoringTest . Presentation ;
8+
9+ public class DirectoryStructureShould
10+ {
11+ [ Fact ]
12+ public void IParsingStrategyImplementations_ResideInParsersDirectory ( )
13+ {
14+ foreach ( var type in GetImplementationsOfGenericInterface ( typeof ( IParsingStrategy < > ) ) )
15+ {
16+ type . Namespace . Should ( ) . NotBeNull ( )
17+ . And . StartWith ( Configuration . ParsersNamespace ,
18+ "because all IParsingStrategy implementations should reside in the Parsers directory" ) ;
19+ }
20+ }
21+
22+ private static IEnumerable < Type > GetImplementationsOfGenericInterface ( Type genericInterfaceType )
23+ {
24+ return Assembly . GetAssembly ( genericInterfaceType ) ! . GetTypes ( )
25+ . Where ( t => ! t . IsAbstract && t . GetInterfaces ( )
26+ . Any ( i => i . IsGenericType && i . GetGenericTypeDefinition ( ) == genericInterfaceType ) ) ;
27+ }
28+ }
You can’t perform that action at this time.
0 commit comments