@@ -11,12 +11,18 @@ namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.Configurations
11
11
public class LanguageXmlTests
12
12
{
13
13
[ Test ]
14
+ [ Platform ( "Win" ) ] //TODO figure out why Path.GetFullPath("/mnt/c/...") is not considered an absolute path on linux + mac
14
15
public void Can_Load_Language_Xml_Files ( )
15
16
{
16
- var languageDirectory = GetLanguageDirectory ( ) ;
17
+ var languageDirectoryPath = GetLanguageDirectory ( ) ;
17
18
var readFilesCount = 0 ;
18
19
var xmlDocument = new XmlDocument ( ) ;
19
- foreach ( var languageFile in languageDirectory . EnumerateFiles ( "*.xml" ) )
20
+
21
+ var directoryInfo = new DirectoryInfo ( languageDirectoryPath ) ;
22
+ Console . WriteLine ( "directoryInfo:" + directoryInfo ) ;
23
+ Console . WriteLine ( "FullName:" + directoryInfo . FullName ) ;
24
+
25
+ foreach ( var languageFile in directoryInfo . GetFiles ( "*.xml" , SearchOption . TopDirectoryOnly ) )
20
26
{
21
27
// Load will throw an exception if the XML isn't valid.
22
28
xmlDocument . Load ( languageFile . FullName ) ;
@@ -27,10 +33,11 @@ public void Can_Load_Language_Xml_Files()
27
33
Assert . AreNotEqual ( 0 , readFilesCount ) ;
28
34
}
29
35
30
- private static DirectoryInfo GetLanguageDirectory ( )
36
+ private static string GetLanguageDirectory ( )
31
37
{
32
38
var testDirectoryPathParts = Path . GetDirectoryName ( TestContext . CurrentContext . TestDirectory )
33
39
. Split ( new [ ] { Path . DirectorySeparatorChar , Path . AltDirectorySeparatorChar } , StringSplitOptions . RemoveEmptyEntries ) ;
40
+
34
41
var solutionDirectoryPathParts = testDirectoryPathParts
35
42
. Take ( Array . IndexOf ( testDirectoryPathParts , "tests" ) ) ;
36
43
var languageFolderPathParts = new List < string > ( solutionDirectoryPathParts ) ;
@@ -44,7 +51,7 @@ private static DirectoryInfo GetLanguageDirectory()
44
51
languageFolderPathParts . Insert ( languageFolderPathParts . Count - additionalPathParts . Length , "src" ) ;
45
52
}
46
53
47
- return new DirectoryInfo ( string . Join ( Path . DirectorySeparatorChar . ToString ( ) , languageFolderPathParts ) ) ;
54
+ return string . Join ( Path . DirectorySeparatorChar . ToString ( ) , languageFolderPathParts ) ;
48
55
}
49
56
}
50
57
}
0 commit comments