Created
January 28, 2016 19:12
-
-
Save vendettamit/1470b06c950ab0bd4dde to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
internal class ProcessInvoker | |
{ | |
/// <summary> | |
/// Invokes the host process for test service | |
/// </summary> | |
public static void InvokeDummyService() | |
{ | |
var path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); | |
ProcessStartInfo info = new ProcessStartInfo(Path.Combine(path, "DummyService.exe")); | |
info.UseShellExecute = true; | |
info.WorkingDirectory = path; | |
var process = Process.Start(info); | |
// This is what would attach the process to current VS debugger | |
AttachDebugger.ToProcess(process.Id); | |
} | |
/// <summary> | |
/// Kills the process of service host | |
/// </summary> | |
public static void KillDummyService() | |
{ | |
Process.GetProcessesByName("DummyService").ToList().ForEach(x => x.Kill()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment