Skip to content

Commit fb953ad

Browse files
committed
Only run this test on windows
1 parent ab96e7c commit fb953ad

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

tests/Umbraco.Tests.UnitTests/Umbraco.Core/Configurations/LanguageXmlTests.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,18 @@ namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Core.Configurations
1111
public class LanguageXmlTests
1212
{
1313
[Test]
14+
[Platform("Win")] //TODO figure out why Path.GetFullPath("/mnt/c/...") is not considered an absolute path on linux + mac
1415
public void Can_Load_Language_Xml_Files()
1516
{
16-
var languageDirectory = GetLanguageDirectory();
17+
var languageDirectoryPath = GetLanguageDirectory();
1718
var readFilesCount = 0;
1819
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))
2026
{
2127
// Load will throw an exception if the XML isn't valid.
2228
xmlDocument.Load(languageFile.FullName);
@@ -27,10 +33,11 @@ public void Can_Load_Language_Xml_Files()
2733
Assert.AreNotEqual(0, readFilesCount);
2834
}
2935

30-
private static DirectoryInfo GetLanguageDirectory()
36+
private static string GetLanguageDirectory()
3137
{
3238
var testDirectoryPathParts = Path.GetDirectoryName(TestContext.CurrentContext.TestDirectory)
3339
.Split(new[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries);
40+
3441
var solutionDirectoryPathParts = testDirectoryPathParts
3542
.Take(Array.IndexOf(testDirectoryPathParts, "tests"));
3643
var languageFolderPathParts = new List<string>(solutionDirectoryPathParts);
@@ -44,7 +51,7 @@ private static DirectoryInfo GetLanguageDirectory()
4451
languageFolderPathParts.Insert(languageFolderPathParts.Count - additionalPathParts.Length, "src");
4552
}
4653

47-
return new DirectoryInfo(string.Join(Path.DirectorySeparatorChar.ToString(), languageFolderPathParts));
54+
return string.Join(Path.DirectorySeparatorChar.ToString(), languageFolderPathParts);
4855
}
4956
}
5057
}

0 commit comments

Comments
 (0)