File tree Expand file tree Collapse file tree
Src/Axuno.VirtualFileSystem.Tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ public static string GetTargetProjectPath(Type classFromTargetAssembly)
1616 var targetAssembly = classFromTargetAssembly . GetTypeInfo ( ) . Assembly ;
1717
1818 // Get name of the target project which we want to test
19- var projectName = targetAssembly . GetName ( ) . Name ;
19+ var projectName = targetAssembly . GetName ( ) . Name ?? throw new Exception ( "Assembly name is null" ) ;
2020
2121 // Get currently executing test project path
2222 var applicationBasePath = AppContext . BaseDirectory ;
@@ -26,6 +26,7 @@ public static string GetTargetProjectPath(Type classFromTargetAssembly)
2626 do
2727 {
2828 directoryInfo = directoryInfo . Parent ;
29+ if ( directoryInfo == null ) break ;
2930
3031 var projectDirectoryInfo = new DirectoryInfo ( directoryInfo . FullName ) ;
3132 if ( projectDirectoryInfo . Exists )
@@ -37,9 +38,10 @@ public static string GetTargetProjectPath(Type classFromTargetAssembly)
3738 }
3839 }
3940 }
40- while ( directoryInfo . Parent != null || directoryInfo . Parent . FullName . EndsWith ( " \\ " + projectName ) ) ;
41+ while ( directoryInfo . Parent != null ) ;
4142
4243 throw new Exception ( $ "Project root could not be located using the application root { applicationBasePath } .") ;
4344 }
4445 }
46+
4547}
You can’t perform that action at this time.
0 commit comments