public void TestExceptionCatch() { var settings = new MockSettingsService(); var tempPath = Infrastructure.Directory.Temp(); psExit = new FileInfo(tempPath.FullName + "\\exit.ps1"); File.WriteAllText(psExit.FullName, $"try {{ throw 'error' }} catch {{ }}"); var sc = new Clients.ScriptClient(log, settings); var success = sc.RunScript(psExit.FullName, "", "").Result; Assert.AreEqual(true, success); }
public void TestExit(int exit, bool expectedSuccess) { var settings = new MockSettingsService(); var tempPath = Infrastructure.Directory.Temp(); psExit = new FileInfo(tempPath.FullName + "\\exit.ps1"); File.WriteAllText(psExit.FullName, $"exit {exit}"); var sc = new Clients.ScriptClient(log, settings); var success = sc.RunScript(psExit.FullName, "", "").Result; Assert.AreEqual(expectedSuccess, success); }