public void InvalidProcessStartProcessTest() { var fpb = new FetProcessBuilder(); _process = fpb.CreateProcess(); _fpi = new FetProcessFacadeExposer(_process, CancellationToken.None); var task = _fpi.StartProcess(); // Assertions var ex = Assert.Throws <AggregateException>(() => task.Wait()); Assert.IsInstanceOf <InvalidOperationException>(ex.InnerException); }
public void CheckProcessNonZeroExitCodeTest() { // Create process again with different arguments var fpb = new FetProcessBuilder(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "lib", "fet", "fet-cl")); // Invalid input file fpb.SetInputFile(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "testdata", "fet", "invalid.xml")); var tempDir = Path.Combine(Path.GetTempPath(), "timetabling-tests"); Directory.CreateDirectory(tempDir); fpb.SetOutputDir(tempDir); _process = fpb.CreateProcess(); _fpi = new FetProcessFacadeExposer(_process, CancellationToken.None); // Start process _fpi.StartProcess(); var ex = Assert.Throws <AggregateException>(() => _fpi.TaskCompletionSource.Task.Wait()); Assert.IsInstanceOf <InvalidOperationException>(ex.InnerException); }
public void CheckProcessZeroExitCodeTest() { // Create process again with different arguments var fpb = new FetProcessBuilder(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "lib", "fet", "fet-cl")); // Hopwood runs usually very fast fpb.SetInputFile(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "testdata", "fet", "United-Kingdom", "Hopwood", "Hopwood.fet")); var tempDir = Path.Combine(Path.GetTempPath(), "timetabling-tests"); Directory.CreateDirectory(tempDir); fpb.SetOutputDir(tempDir); _process = fpb.CreateProcess(); _fpi = new FetProcessFacadeExposer(_process, CancellationToken.None); // Start process _fpi.StartProcess(); var task = _fpi.TaskCompletionSource.Task; task.Wait(); }
public void StartProcessTest() { _fpi.StartProcess(); Assert.IsFalse(_fpi.Process.HasExited); _fpi.KillProcess(); }