public IEnumerable<Executable> FindExecutables(string siteName) { var binFolder = Path.Combine(_sitesPath, siteName, "bin"); if (!Directory.Exists(binFolder)) yield break; var subDirs = Directory.EnumerateDirectories(binFolder); foreach (var d in subDirs) { var subDir = d.Split(Path.DirectorySeparatorChar).Last(); var exe = new Executable(binFolder, subDir); if (exe.Exists()) yield return exe; } }
public void Setup() { if (Directory.Exists(OriginalPath)) Retry.On<IOException>().For(TimeSpan.FromSeconds(5)).With(c => Directory.Delete(OriginalPath, true)); if (Directory.Exists(ExecutePath)) Retry.On<IOException>().For(TimeSpan.FromSeconds(5)).With(c => Directory.Delete(ExecutePath, true)); Directory.CreateDirectory(Path.Combine(OriginalPath, ExeName)); File.WriteAllText(Path.Combine(OriginalPath, ExeName, string.Format("{0}.exe", ExeName)), ExeContents); File.WriteAllText(Path.Combine(OriginalPath, ExeName, RandomFilePath), RandomFileContents); File.WriteAllText(Path.Combine(TestPath, "web.config"), WebConfigContents); _e = new Executable(OriginalPath, ExeName); }