public static MapListItem GetFirstMapInFolder(string sourceMapFolder, bool isValid) { foreach (string file in Directory.GetFiles(sourceMapFolder, "*.umap")) { FileInfo fileInfo = new FileInfo(file); MapListItem map = new MapListItem() { FullPath = file, MapName = fileInfo.NameWithoutExtension() }; map.Validate(); if (map.IsValid == isValid) { return(map); } } foreach (string dir in Directory.GetDirectories(sourceMapFolder)) { MapListItem foundMap = GetFirstMapInFolder(dir, isValid); if (foundMap != null) { return(foundMap); } } return(null); }
public void Test_Validate_MissingFile_ValidationHint_Set() { MapListItem testItem = new MapListItem() { FullPath = Path.Combine(TestPaths.ToTestFilesFolder, "Mock_Map_Files", "notAMap.umap"), MapName = "notAMap" }; testItem.Validate(); string expectedHint = "(file missing)"; Assert.AreEqual(expectedHint, testItem.ValidationHint); }